2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe ArchiveTraceWorker do
|
2018-03-17 18:26:18 +05:30
|
|
|
describe '#perform' do
|
|
|
|
subject { described_class.new.perform(job&.id) }
|
|
|
|
|
|
|
|
context 'when job is found' do
|
2019-02-15 15:39:39 +05:30
|
|
|
let(:job) { create(:ci_build, :trace_live) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
it 'executes service' do
|
2019-02-15 15:39:39 +05:30
|
|
|
expect_any_instance_of(Ci::ArchiveTraceService)
|
2019-10-12 21:52:04 +05:30
|
|
|
.to receive(:execute).with(job, anything)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when job is not found' do
|
|
|
|
let(:job) { nil }
|
|
|
|
|
|
|
|
it 'does not execute service' do
|
2019-02-15 15:39:39 +05:30
|
|
|
expect_any_instance_of(Ci::ArchiveTraceService)
|
|
|
|
.not_to receive(:execute)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|