summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-08 06:08:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-08 06:08:50 +0000
commit6397f0322d3841d98d64e9c60bb84b94c40617d7 (patch)
treecc54eebf050e102dcf7394f5b94b7699148050df /spec/workers
parent91ed938e3d17d385a08459915972d7e3f6b8468e (diff)
downloadgitlab-ce-6397f0322d3841d98d64e9c60bb84b94c40617d7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/ci/pipeline_bridge_status_worker_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/workers/ci/pipeline_bridge_status_worker_spec.rb b/spec/workers/ci/pipeline_bridge_status_worker_spec.rb
new file mode 100644
index 00000000000..d5f95a035fd
--- /dev/null
+++ b/spec/workers/ci/pipeline_bridge_status_worker_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Ci::PipelineBridgeStatusWorker do
+ describe '#perform' do
+ subject { described_class.new.perform(pipeline_id) }
+
+ context 'when pipeline exists' do
+ let(:pipeline) { create(:ci_pipeline) }
+ let(:pipeline_id) { pipeline.id }
+
+ it 'calls the service' do
+ service = double('bridge status service')
+
+ expect(Ci::PipelineBridgeStatusService)
+ .to receive(:new)
+ .with(pipeline.project, pipeline.user)
+ .and_return(service)
+
+ expect(service).to receive(:execute).with(pipeline)
+
+ subject
+ end
+ end
+
+ context 'when pipeline does not exist' do
+ let(:pipeline_id) { 1234 }
+
+ it 'does not call the service' do
+ expect(Ci::PipelineBridgeStatusService)
+ .not_to receive(:new)
+
+ subject
+ end
+ end
+ end
+end