gitlab-org--gitlab-foss/spec/workers/archive_trace_worker_spec.rb

32 lines
666 B
Ruby
Raw Normal View History

# 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
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)
.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