diff options
Diffstat (limited to 'spec/services/groups/group_links/destroy_service_spec.rb')
-rw-r--r-- | spec/services/groups/group_links/destroy_service_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/services/groups/group_links/destroy_service_spec.rb b/spec/services/groups/group_links/destroy_service_spec.rb index 284bcd0df2e..8989f024262 100644 --- a/spec/services/groups/group_links/destroy_service_spec.rb +++ b/spec/services/groups/group_links/destroy_service_spec.rb @@ -8,14 +8,20 @@ describe Groups::GroupLinks::DestroyService, '#execute' do let_it_be(:group) { create(:group, :private) } let_it_be(:shared_group) { create(:group, :private) } let_it_be(:project) { create(:project, group: shared_group) } + let_it_be(:owner) { create(:user) } - subject { described_class.new(nil, nil) } + before do + group.add_developer(owner) + shared_group.add_owner(owner) + end + + subject { described_class.new(shared_group, owner) } context 'single link' do let!(:link) { create(:group_group_link, shared_group: shared_group, shared_with_group: group) } it 'destroys link' do - expect { subject.execute(link) }.to change { GroupGroupLink.count }.from(1).to(0) + expect { subject.execute(link) }.to change { shared_group.shared_with_group_links.count }.from(1).to(0) end it 'revokes project authorization' do |