summaryrefslogtreecommitdiff
path: root/spec/workers/archive_trace_worker_spec.rb
blob: 368ed3f3db14cdfa1f3cdf81533b8d407f7d968e (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
# frozen_string_literal: true

require 'spec_helper'

describe ArchiveTraceWorker do
  describe '#perform' do
    subject { described_class.new.perform(job&.id) }

    context 'when job is found' do
      let(:job) { create(:ci_build, :trace_live) }

      it 'executes service' do
        expect_any_instance_of(Ci::ArchiveTraceService)
          .to receive(:execute).with(job)

        subject
      end
    end

    context 'when job is not found' do
      let(:job) { nil }

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

        subject
      end
    end
  end
end