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>2020-06-25 18:08:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-25 18:08:37 +0300
commit65f5f75e3a3b0b9f4ea6035294f81977fa8a2bb5 (patch)
tree586044dafa068c45a77d07ceea8bec15bf9dbcae /spec/services/ci/create_pipeline_service
parent333f76ab664f610fb1c2cc6069c48a570791a792 (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.rb51
1 files changed, 51 insertions, 0 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
new file mode 100644
index 00000000000..27af212d41c
--- /dev/null
+++ b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb
@@ -0,0 +1,51 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Ci::CreatePipelineService do
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:user) { create(:admin) }
+ let(:service) { described_class.new(project, user, { ref: 'refs/heads/master' }) }
+ let(:content) do
+ <<~EOY
+ ---
+ stages:
+ - dast
+
+ variables:
+ DAST_VERSION: 1
+ SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
+
+ dast:
+ stage: dast
+ image:
+ name: "$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION"
+ variables:
+ GIT_STRATEGY: none
+ script:
+ - /analyze
+ EOY
+ end
+
+ describe '#execute' do
+ subject { service.execute(:web, content: content) }
+
+ 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 stages with the correct names' do
+ expect(subject.stages.pluck(:name)).to match_array %w[dast]
+ end
+
+ it 'sets the correct config source' do
+ expect(subject.config_source).to eq 'parameter_source'
+ end
+ end
+ end
+end