gitlab-org--gitlab-foss/spec/workers/pipeline_notification_worker_spec.rb
Lin Jen-Shin bb5f79d43e Don't include EmailHelpers manually, pick with rspec
`:mailer` is needed to pick it easily, while
`type: :mailer` is needed for picking it automatically for
tests located in spec/mailers/*_spec.rb

It's a bit complicated in spec/services/notification_service_spec.rb
but we'll leave it alone for now.
2017-08-03 21:55:48 +08:00

19 lines
541 B
Ruby

require 'spec_helper'
describe PipelineNotificationWorker, :mailer do
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