2019-03-30 03:15:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-29 11:56:12 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-03-06 07:40:50 -05:00
|
|
|
describe ArchiveTraceWorker do
|
2018-01-29 11:56:12 -05:00
|
|
|
describe '#perform' do
|
2018-01-31 09:48:48 -05:00
|
|
|
subject { described_class.new.perform(job&.id) }
|
2018-01-29 11:56:12 -05:00
|
|
|
|
|
|
|
context 'when job is found' do
|
2018-11-29 00:51:03 -05:00
|
|
|
let(:job) { create(:ci_build, :trace_live) }
|
2018-01-29 11:56:12 -05:00
|
|
|
|
|
|
|
it 'executes service' do
|
2018-11-29 00:51:03 -05:00
|
|
|
expect_any_instance_of(Ci::ArchiveTraceService)
|
2019-07-18 05:22:46 -04:00
|
|
|
.to receive(:execute).with(job, anything)
|
2018-01-29 11:56:12 -05:00
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when job is not found' do
|
|
|
|
let(:job) { nil }
|
|
|
|
|
|
|
|
it 'does not execute service' do
|
2018-11-29 00:51:03 -05:00
|
|
|
expect_any_instance_of(Ci::ArchiveTraceService)
|
|
|
|
.not_to receive(:execute)
|
2018-01-29 11:56:12 -05:00
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|