gitlab-org--gitlab-foss/spec/workers/pipeline_notification_worker_spec.rb
Sean McGivern a1805cbcd5 Quiet pipeline emails
1. Never send a pipeline email to anyone other than the user who created
   the pipeline.
2. Only send pipeline success emails to people with the custom
   notification setting for enabled. Watchers and participants will
   never receive this.
3. When custom settings are unset (for new settings and legacy ones),
   act as if failed_pipeline is set.
2017-04-03 13:59:48 +01:00

21 lines
556 B
Ruby

require 'spec_helper'
describe PipelineNotificationWorker do
include EmailHelpers
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