Commit 583b49f0 authored by Shinya Maeda's avatar Shinya Maeda

Add spec for workers

parent 824af79d
require 'spec_helper'
describe ArchiveLegacyTraceWorker do
it { is_expected.to be_a(ObjectStorageQueue) }
it { is_expected.not_to be_a(PipelineQueue) }
describe '#perform' do
subject { described_class.new.perform(job&.id) }
context 'when job is found' do
let(:job) { create(:ci_build) }
it 'executes service' do
expect_any_instance_of(Gitlab::Ci::Trace).to receive(:archive!)
subject
end
end
context 'when job is not found' do
let(:job) { nil }
it 'does not execute service' do
expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive!)
subject
end
end
end
end
......@@ -8,8 +8,7 @@ describe CreateTraceArtifactWorker do
let(:job) { create(:ci_build) }
it 'executes service' do
expect_any_instance_of(Ci::CreateTraceArtifactService)
.to receive(:execute).with(job)
expect_any_instance_of(Gitlab::Ci::Trace).to receive(:archive!)
subject
end
......@@ -19,8 +18,7 @@ describe CreateTraceArtifactWorker do
let(:job) { nil }
it 'does not execute service' do
expect_any_instance_of(Ci::CreateTraceArtifactService)
.not_to receive(:execute)
expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive!)
subject
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment