diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-03 12:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-03 12:08:53 +0300 |
commit | 1c75400c24137f603678d0ee3d497b0c9280e7f7 (patch) | |
tree | ccf2e8584d8b7efd3c648a276ebe5b456639da3b /spec/services/ci/create_pipeline_service | |
parent | 1f23012963babbcc586e7025cc28e62385813fb6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ci/create_pipeline_service')
-rw-r--r-- | spec/services/ci/create_pipeline_service/parameter_content_spec.rb | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/spec/services/ci/create_pipeline_service/parameter_content_spec.rb b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb index a0b62ad5194..5157574ea04 100644 --- a/spec/services/ci/create_pipeline_service/parameter_content_spec.rb +++ b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb @@ -28,23 +28,34 @@ RSpec.describe Ci::CreatePipelineService do end describe '#execute' do - subject { service.execute(:web, content: content) } + context 'when source is a dangling build' do + subject { service.execute(:ondemand_dast_scan, content: content) } - context 'parameter config content' do - it 'creates a pipeline' do - expect(subject).to be_persisted - end + context 'parameter config content' do + it 'creates a pipeline' do + expect(subject).to be_persisted + end - it 'creates builds with the correct names' do - expect(subject.builds.pluck(:name)).to match_array %w[dast] - end + it 'creates builds with the correct names' do + expect(subject.builds.pluck(:name)).to match_array %w[dast] + end + + it 'creates stages with the correct names' do + expect(subject.stages.pluck(:name)).to match_array %w[dast] + end - it 'creates stages with the correct names' do - expect(subject.stages.pluck(:name)).to match_array %w[dast] + it 'sets the correct config source' do + expect(subject.config_source).to eq 'parameter_source' + end end + end + + context 'when source is not a dangling build' do + subject { service.execute(:web, content: content) } - it 'sets the correct config source' do - expect(subject.config_source).to eq 'parameter_source' + it 'raises an exception' do + klass = Gitlab::Ci::Pipeline::Chain::Config::Content::Parameter::UnsupportedSourceError + expect { subject }.to raise_error(klass) end end end |