diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-24 00:14:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-24 00:14:11 +0000 |
commit | f70958a8932f70733e08ee1774edd28423bac59e (patch) | |
tree | 255c18df6d34de3972d4b53f1916fab05fb6f228 /spec/services | |
parent | 0978fc4c40151a0dccbcb3d348969a6920a58e09 (diff) | |
download | gitlab-ce-f70958a8932f70733e08ee1774edd28423bac59e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 26 | ||||
-rw-r--r-- | spec/services/merge_requests/update_service_spec.rb | 26 | ||||
-rw-r--r-- | spec/services/work_items/update_service_spec.rb | 32 |
3 files changed, 84 insertions, 0 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 8a2e9ed74f7..2cc3d50f290 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -495,6 +495,32 @@ RSpec.describe Issues::UpdateService, :mailer do expect(note.note).to eq('changed the description') end + + it 'triggers GraphQL description updated subscription' do + expect(GraphqlTriggers).to receive(:issuable_description_updated).with(issue).and_call_original + + update_issue(description: 'Changed description') + end + + context 'when broadcast_issuable_description_updated is disabled' do + before do + stub_feature_flags(broadcast_issuable_description_updated: false) + end + + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_issue(title: 'Changed title') + end + end + end + + context 'when decription is not changed' do + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_issue(title: 'Changed title') + end end context 'when issue turns confidential' do diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index 8ebabd64d8a..5d76fb051f2 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -625,6 +625,32 @@ RSpec.describe MergeRequests::UpdateService, :mailer do expect(Todo.count).to eq(2) end + + it 'triggers GraphQL description updated subscription' do + expect(GraphqlTriggers).to receive(:issuable_description_updated).with(merge_request).and_call_original + + update_merge_request(description: 'updated description') + end + + context 'when broadcast_issuable_description_updated is disabled' do + before do + stub_feature_flags(broadcast_issuable_description_updated: false) + end + + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_merge_request(description: 'updated description') + end + end + end + + context 'when decription is not changed' do + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_merge_request(title: 'updated title') + end end context 'when is reassigned' do diff --git a/spec/services/work_items/update_service_spec.rb b/spec/services/work_items/update_service_spec.rb index e8b82b0b4f2..ae5785a8c4b 100644 --- a/spec/services/work_items/update_service_spec.rb +++ b/spec/services/work_items/update_service_spec.rb @@ -88,6 +88,38 @@ RSpec.describe WorkItems::UpdateService do end end + context 'when decription is changed' do + let(:opts) { { description: 'description changed' } } + + it 'triggers GraphQL description updated subscription' do + expect(GraphqlTriggers).to receive(:issuable_description_updated).with(work_item).and_call_original + + update_work_item + end + + context 'when broadcast_issuable_description_updated is disabled' do + before do + stub_feature_flags(broadcast_issuable_description_updated: false) + end + + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_work_item + end + end + end + + context 'when decription is not changed' do + let(:opts) { { title: 'title changed' } } + + it 'does not trigger GraphQL description updated subscription' do + expect(GraphqlTriggers).not_to receive(:issuable_description_updated) + + update_work_item + end + end + context 'when updating state_event' do context 'when state_event is close' do let(:opts) { { state_event: 'close' } } |