diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 15:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 15:08:59 +0300 |
commit | 7351a484d79236b7e9d47c86f2fcc970b7ae10b0 (patch) | |
tree | 651b5fca7ea0460e3ce7c687cfa9e3a3b37eefc8 /spec/workers | |
parent | b4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/ci/create_cross_project_pipeline_worker_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb b/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb new file mode 100644 index 00000000000..22eab1d20f7 --- /dev/null +++ b/spec/workers/ci/create_cross_project_pipeline_worker_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Ci::CreateCrossProjectPipelineWorker 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::CreateCrossProjectPipelineService) + .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::CreateCrossProjectPipelineService) + .not_to receive(:new) + + described_class.new.perform(1234) + end + end + end +end |