2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe PipelineNotificationWorker, :mailer do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(: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)
|
|
|
|
|
|
|
|
subject.perform(pipeline.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does nothing when the pipeline does not exist' do
|
|
|
|
expect(NotificationService).not_to receive(:new)
|
|
|
|
|
|
|
|
subject.perform(Ci::Pipeline.maximum(:id).to_i.succ)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|