diff options
Diffstat (limited to 'spec/support/shared_examples/resource_events.rb')
-rw-r--r-- | spec/support/shared_examples/resource_events.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/support/shared_examples/resource_events.rb b/spec/support/shared_examples/resource_events.rb index 66f5e760c37..c0158f9b24b 100644 --- a/spec/support/shared_examples/resource_events.rb +++ b/spec/support/shared_examples/resource_events.rb @@ -2,7 +2,7 @@ require 'spec_helper' -shared_examples 'a resource event' do +RSpec.shared_examples 'a resource event' do let_it_be(:user1) { create(:user) } let_it_be(:user2) { create(:user) } @@ -54,7 +54,7 @@ shared_examples 'a resource event' do end end -shared_examples 'a resource event for issues' do +RSpec.shared_examples 'a resource event for issues' do let_it_be(:user1) { create(:user) } let_it_be(:user2) { create(:user) } @@ -101,9 +101,19 @@ shared_examples 'a resource event for issues' do expect(events).to be_empty end end + + if described_class.method_defined?(:issuable) + describe '#issuable' do + let_it_be(:event1) { create(described_class.name.underscore.to_sym, issue: issue2) } + + it 'returns the expected issuable' do + expect(event1.issuable).to eq(issue2) + end + end + end end -shared_examples 'a resource event for merge requests' do +RSpec.shared_examples 'a resource event for merge requests' do let_it_be(:user1) { create(:user) } let_it_be(:user2) { create(:user) } @@ -132,4 +142,14 @@ shared_examples 'a resource event for merge requests' do expect(events).to be_empty end end + + if described_class.method_defined?(:issuable) + describe '#issuable' do + let_it_be(:event1) { create(described_class.name.underscore.to_sym, merge_request: merge_request2) } + + it 'returns the expected issuable' do + expect(event1.issuable).to eq(merge_request2) + end + end + end end |