diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 09:09:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 09:09:21 +0300 |
commit | c8df22c555ab707a705e57c4257fd3ed1ce7c3b0 (patch) | |
tree | 009fb7c1ff12a6192921212cae404b790fd7d66b /spec/models | |
parent | 9345f69894862e02f3491ea3136c3ed2b23fd5b8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index f775906a545..51a2e2aff67 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -2509,27 +2509,53 @@ describe Ci::Pipeline, :mailer do end end - context 'with success pipeline' do - before do - perform_enqueued_jobs do + shared_examples 'enqueues the notification worker' do + it 'enqueues PipelineUpdateCiRefStatusWorker' do + expect(PipelineUpdateCiRefStatusWorker).to receive(:perform_async).with(pipeline.id) + expect(PipelineNotificationWorker).not_to receive(:perform_async).with(pipeline.id) + + pipeline.succeed + end + + context 'when ci_pipeline_fixed_notifications is disabled' do + before do + stub_feature_flags(ci_pipeline_fixed_notifications: false) + end + + it 'enqueues PipelineNotificationWorker' do + expect(PipelineUpdateCiRefStatusWorker).not_to receive(:perform_async).with(pipeline.id) + expect(PipelineNotificationWorker).to receive(:perform_async).with(pipeline.id) + pipeline.succeed end end + end - it_behaves_like 'sending a notification' + context 'with success pipeline' do + it_behaves_like 'sending a notification' do + before do + perform_enqueued_jobs do + pipeline.succeed + end + end + end + + it_behaves_like 'enqueues the notification worker' end context 'with failed pipeline' do - before do - perform_enqueued_jobs do - create(:ci_build, :failed, pipeline: pipeline) - create(:generic_commit_status, :failed, pipeline: pipeline) + it_behaves_like 'sending a notification' do + before do + perform_enqueued_jobs do + create(:ci_build, :failed, pipeline: pipeline) + create(:generic_commit_status, :failed, pipeline: pipeline) - pipeline.drop + pipeline.drop + end end end - it_behaves_like 'sending a notification' + it_behaves_like 'enqueues the notification worker' end context 'with skipped pipeline' do |