summaryrefslogtreecommitdiff
path: root/spec/workers/ci/daily_build_group_report_results_worker_spec.rb
blob: d9706982a624aaa77b1205c2b39c9cd06ec40327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

require 'spec_helper'

describe Ci::DailyBuildGroupReportResultsWorker do
  describe '#perform' do
    let!(:pipeline) { create(:ci_pipeline) }

    subject { described_class.new.perform(pipeline_id) }

    context 'when pipeline is found' do
      let(:pipeline_id) { pipeline.id }

      it 'executes service' do
        expect_any_instance_of(Ci::DailyBuildGroupReportResultService)
          .to receive(:execute).with(pipeline)

        subject
      end
    end

    context 'when pipeline is not found' do
      let(:pipeline_id) { 123 }

      it 'does not execute service' do
        expect_any_instance_of(Ci::DailyBuildGroupReportResultService)
          .not_to receive(:execute)

        expect { subject }
          .not_to raise_error
      end
    end
  end
end