2016-09-13 13:10:58 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-08-02 12:43:51 -04:00
|
|
|
describe PipelineNotificationWorker, :mailer do
|
2017-03-30 07:29:52 -04:00
|
|
|
let(:pipeline) { create(:ci_pipeline) }
|
2016-09-13 13:10:58 -04:00
|
|
|
|
|
|
|
describe '#execute' do
|
2017-03-30 07:29:52 -04:00
|
|
|
it 'calls NotificationService#pipeline_finished when the pipeline exists' do
|
|
|
|
expect(NotificationService).to receive_message_chain(:new, :pipeline_finished)
|
2016-10-21 06:16:39 -04:00
|
|
|
|
2017-03-30 07:29:52 -04:00
|
|
|
subject.perform(pipeline.id)
|
2016-09-13 13:10:58 -04:00
|
|
|
end
|
|
|
|
|
2017-03-30 07:29:52 -04:00
|
|
|
it 'does nothing when the pipeline does not exist' do
|
|
|
|
expect(NotificationService).not_to receive(:new)
|
2016-09-14 07:23:04 -04:00
|
|
|
|
2017-03-30 07:29:52 -04:00
|
|
|
subject.perform(Ci::Pipeline.maximum(:id).to_i.succ)
|
2016-09-13 13:10:58 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|