summaryrefslogtreecommitdiff
path: root/spec/workers/pipeline_notification_worker_spec.rb
blob: 139032d77bd49365910b3e223c39277486929024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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