BigW Consortium Gitlab

Commit 583b49f0 by 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 ...@@ -8,8 +8,7 @@ describe CreateTraceArtifactWorker do
let(:job) { create(:ci_build) } let(:job) { create(:ci_build) }
it 'executes service' do it 'executes service' do
expect_any_instance_of(Ci::CreateTraceArtifactService) expect_any_instance_of(Gitlab::Ci::Trace).to receive(:archive!)
.to receive(:execute).with(job)
subject subject
end end
...@@ -19,8 +18,7 @@ describe CreateTraceArtifactWorker do ...@@ -19,8 +18,7 @@ describe CreateTraceArtifactWorker do
let(:job) { nil } let(:job) { nil }
it 'does not execute service' do it 'does not execute service' do
expect_any_instance_of(Ci::CreateTraceArtifactService) expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive!)
.not_to receive(:execute)
subject subject
end 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