diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 21:09:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-27 21:09:21 +0300 |
commit | e0fa0638a422c3e20d4423c9bb69d79afc9c7d3d (patch) | |
tree | 9abb3c0706576bbda895fe9539a55556930606e2 /spec/workers | |
parent | f8d15ca65390475e356b06dedc51e10ccd179f86 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/pipeline_notification_worker_spec.rb | 9 | ||||
-rw-r--r-- | spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb | 18 |
2 files changed, 24 insertions, 3 deletions
diff --git a/spec/workers/pipeline_notification_worker_spec.rb b/spec/workers/pipeline_notification_worker_spec.rb index 98b0f139fe2..5defd3d5bd7 100644 --- a/spec/workers/pipeline_notification_worker_spec.rb +++ b/spec/workers/pipeline_notification_worker_spec.rb @@ -3,13 +3,16 @@ require 'spec_helper' describe PipelineNotificationWorker, :mailer do - let(:pipeline) { create(:ci_pipeline) } + let_it_be(:pipeline) { create(:ci_pipeline) } describe '#execute' do it 'calls NotificationService#pipeline_finished when the pipeline exists' do - expect(NotificationService).to receive_message_chain(:new, :pipeline_finished) + notification_service_double = double + expect(notification_service_double).to receive(:pipeline_finished) + .with(pipeline, ref_status: 'success', recipients: ['test@gitlab.com']) + expect(NotificationService).to receive(:new).and_return(notification_service_double) - subject.perform(pipeline.id) + subject.perform(pipeline.id, ref_status: 'success', recipients: ['test@gitlab.com']) end it 'does nothing when the pipeline does not exist' do diff --git a/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb b/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb new file mode 100644 index 00000000000..7228de4f895 --- /dev/null +++ b/spec/workers/pipeline_update_ci_ref_status_worker_service_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe PipelineUpdateCiRefStatusWorker do + let(:worker) { described_class.new } + let(:pipeline) { create(:ci_pipeline) } + + describe '#perform' do + it 'updates the ci_ref status' do + expect(Ci::UpdateCiRefStatusService).to receive(:new) + .with(pipeline) + .and_return(double(call: true)) + + worker.perform(pipeline.id) + end + end +end |