From 6397f0322d3841d98d64e9c60bb84b94c40617d7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sat, 8 Feb 2020 06:08:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../ci/pipeline_bridge_status_worker_spec.rb | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 spec/workers/ci/pipeline_bridge_status_worker_spec.rb (limited to 'spec/workers') 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 -- cgit v1.2.1