summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-02-28 18:48:08 +0900
committerShinya Maeda <shinya@gitlab.com>2018-03-06 21:43:20 +0900
commit583b49f08e5799508d5ebdf7e6f6ccbbe0a0d0bf (patch)
treea0513ecef93b789c6bafbd1b98b55b6f2e8f0c65 /spec/workers
parent824af79d64b8be277dbddad0936c2b7b8237ce5d (diff)
downloadgitlab-ce-583b49f08e5799508d5ebdf7e6f6ccbbe0a0d0bf.tar.gz
Add spec for workers
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/archive_legacy_trace_worker_spec.rb30
-rw-r--r--spec/workers/create_trace_artifact_worker_spec.rb6
2 files changed, 32 insertions, 4 deletions
diff --git a/spec/workers/archive_legacy_trace_worker_spec.rb b/spec/workers/archive_legacy_trace_worker_spec.rb
new file mode 100644
index 00000000000..28b247e3058
--- /dev/null
+++ b/spec/workers/archive_legacy_trace_worker_spec.rb
@@ -0,0 +1,30 @@
+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
diff --git a/spec/workers/create_trace_artifact_worker_spec.rb b/spec/workers/create_trace_artifact_worker_spec.rb
index 854abd9cca7..5fc2b183abc 100644
--- a/spec/workers/create_trace_artifact_worker_spec.rb
+++ b/spec/workers/create_trace_artifact_worker_spec.rb
@@ -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