pipeline_notification_worker_spec.rb 556 字节
Newer Older
L
Lin Jen-Shin 已提交
1 2
require 'spec_helper'

3
describe PipelineNotificationWorker do
4 5
  include EmailHelpers

S
Sean McGivern 已提交
6
  let(:pipeline) { create(:ci_pipeline) }
L
Lin Jen-Shin 已提交
7 8

  describe '#execute' do
S
Sean McGivern 已提交
9 10
    it 'calls NotificationService#pipeline_finished when the pipeline exists' do
      expect(NotificationService).to receive_message_chain(:new, :pipeline_finished)
11

S
Sean McGivern 已提交
12
      subject.perform(pipeline.id)
L
Lin Jen-Shin 已提交
13 14
    end

S
Sean McGivern 已提交
15 16
    it 'does nothing when the pipeline does not exist' do
      expect(NotificationService).not_to receive(:new)
L
Lin Jen-Shin 已提交
17

S
Sean McGivern 已提交
18
      subject.perform(Ci::Pipeline.maximum(:id).to_i.succ)
L
Lin Jen-Shin 已提交
19 20 21
    end
  end
end