Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-23 15:11:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-23 15:11:29 +0300
commit8c4e384860c39494c3436b7d6f3567458f79f0d9 (patch)
tree5d12275772ad85ba7ed108ebb0db7f30f193030c /spec/workers/ci
parent66e4d1bf78b3ec2075135173b12767692ced242c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/ci')
-rw-r--r--spec/workers/ci/create_downstream_pipeline_worker_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/workers/ci/create_downstream_pipeline_worker_spec.rb b/spec/workers/ci/create_downstream_pipeline_worker_spec.rb
new file mode 100644
index 00000000000..7a75da850d9
--- /dev/null
+++ b/spec/workers/ci/create_downstream_pipeline_worker_spec.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::CreateDownstreamPipelineWorker do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project) }
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
+
+ let(:bridge) { create(:ci_bridge, user: user, pipeline: pipeline) }
+
+ let(:service) { double('pipeline creation service') }
+
+ describe '#perform' do
+ context 'when bridge exists' do
+ it 'calls cross project pipeline creation service' do
+ expect(Ci::CreateDownstreamPipelineService)
+ .to receive(:new)
+ .with(project, user)
+ .and_return(service)
+
+ expect(service).to receive(:execute).with(bridge)
+
+ described_class.new.perform(bridge.id)
+ end
+ end
+
+ context 'when bridge does not exist' do
+ it 'does nothing' do
+ expect(Ci::CreateDownstreamPipelineService)
+ .not_to receive(:new)
+
+ described_class.new.perform(non_existing_record_id)
+ end
+ end
+ end
+end