diff options
Diffstat (limited to 'spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb b/spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb index 1532e870dcc..b955b71a6bb 100644 --- a/spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb +++ b/spec/support/shared_examples/services/issuable_links/destroyable_issuable_links_shared_examples.rb @@ -1,13 +1,7 @@ # frozen_string_literal: true -RSpec.shared_examples 'a destroyable issuable link' do |required_role: :reporter| +RSpec.shared_examples 'a destroyable issuable link' do context 'when successfully removes an issuable link' do - before do - [issuable_link.target, issuable_link.source].each do |issuable| - issuable.resource_parent.try(:"add_#{required_role}", user) - end - end - it 'removes related issue' do expect { subject }.to change { issuable_link.class.count }.by(-1) end @@ -28,6 +22,9 @@ RSpec.shared_examples 'a destroyable issuable link' do |required_role: :reporter end context 'when failing to remove an issuable link' do + let_it_be(:non_member) { create(:user) } + let(:user) { non_member } + it 'does not remove relation' do expect { subject }.not_to change { issuable_link.class.count }.from(1) end |