diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-01-08 13:54:18 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-01-11 13:50:44 +0300 |
commit | e672ed849484d5ff830ebfe4e3c32b984a6902f2 (patch) | |
tree | 3e95bf7f5c6821e32de70c05708a158fc25837f3 /spec/models/project_spec.rb | |
parent | a996e4e3b3fb25b365e4dc6bfb0766cc71f4cae5 (diff) |
Nullify pool_repository when a project leaves
Previously the nullification wasn't done, as the only caller would later
destroy the model all together. In
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9070 this change
was made. This commit is basically a backport before that MR is merged.
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d1ab0bdba29..b48a9048a42 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -4387,6 +4387,17 @@ describe Project do end end + describe '#leave_pool_repository' do + let(:pool) { create(:pool_repository) } + let(:project) { create(:project, :repository, pool_repository: pool) } + + it 'removes the membership' do + project.leave_pool_repository + + expect(pool.member_projects.reload).not_to include(project) + end + end + def rugged_config rugged_repo(project.repository).config end |