diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-01 21:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-01 21:08:46 +0300 |
commit | 1c7a88b121670eb5732ff4ddac3a2121fb36395a (patch) | |
tree | 5ca1e7e6b9e3e0a61908cfbd5ac86fb55dfc4699 /spec/support/services | |
parent | cdd826bc3ad3e6f234f96a861efa129dba5e2502 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/services')
-rw-r--r-- | spec/support/services/issuable_update_service_shared_examples.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/support/services/issuable_update_service_shared_examples.rb b/spec/support/services/issuable_update_service_shared_examples.rb index 4d2843af1c4..b0e279b9601 100644 --- a/spec/support/services/issuable_update_service_shared_examples.rb +++ b/spec/support/services/issuable_update_service_shared_examples.rb @@ -23,3 +23,33 @@ RSpec.shared_examples 'issuable update service' do end end end + +RSpec.shared_examples 'broadcasting issuable labels updates' do + before do + update_issuable(label_ids: [label_a.id]) + end + + context 'when label is added' do + it 'triggers the GraphQL subscription' do + expect(GraphqlTriggers).to receive(:issuable_labels_updated).with(issuable) + + update_issuable({ add_label_ids: [label_b.id] }) + end + end + + context 'when label is removed' do + it 'triggers the GraphQL subscription' do + expect(GraphqlTriggers).to receive(:issuable_labels_updated).with(issuable) + + update_issuable({ remove_label_ids: [label_a.id] }) + end + end + + context 'when label is unchanged' do + it 'does not trigger the GraphQL subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_labels_updated).with(issuable) + + update_issuable({ label_ids: [label_a.id] }) + end + end +end |