gitlab-org--gitlab-foss/spec/workers/archive_trace_worker_spec.rb
Shinya Maeda c2e0e689f3 Validate the existence of archived traces before removing live trace
Often live traces are removed even though the archived trace
doesn't exist. This commit checkes the existence strictly.
2019-07-23 17:26:08 +07:00

31 lines
666 B
Ruby

# 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, anything)
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