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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-21 14:12:45 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-21 14:12:45 +0300
commitb82de0f0087a91165a7306fa9fe11a0cbc48fcd5 (patch)
treeec9aba0ff75b628dc0cb9303525e63cd4471305a /spec/lib/gitlab/ci/pipeline/chain
parent585e6a992fcd1baa712ae436bbacd76672f614c8 (diff)
Reduce stage seeds coupling between pipeline and YAML
This is a first step to decouple pipeline from YAML processing. It reduces the coupling by removing some methods that introduce coupling and by moving logic into separate chain element that is being used to populate pipelines with stages and builds.
Diffstat (limited to 'spec/lib/gitlab/ci/pipeline/chain')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb26
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb22
2 files changed, 26 insertions, 22 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
index f1fc7acb969..115c76aff2d 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
@@ -42,6 +42,32 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
end
end
+ context 'when pipeline is empty' do
+ let(:config) do
+ { rspec: {
+ script: 'ls',
+ only: ['something']
+ } }
+ end
+
+ let(:pipeline) do
+ build(:ci_pipeline, project: project, config: config)
+ end
+
+ before do
+ step.perform!
+ end
+
+ it 'breaks the chain' do
+ expect(step.break?).to be true
+ end
+
+ it 'appends an error about missing stages' do
+ expect(pipeline.errors.to_a)
+ .to include 'No stages / jobs for this pipeline.'
+ end
+ end
+
context 'when pipeline has validation errors' do
let(:pipeline) do
build(:ci_pipeline, project: project, ref: nil)
diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb
index 5c12c6e6392..c53294d091c 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb
@@ -76,28 +76,6 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do
end
end
- context 'when pipeline has no stages / jobs' do
- let(:config) do
- { rspec: {
- script: 'ls',
- only: ['something']
- } }
- end
-
- let(:pipeline) do
- build(:ci_pipeline, project: project, config: config)
- end
-
- it 'appends an error about missing stages' do
- expect(pipeline.errors.to_a)
- .to include 'No stages / jobs for this pipeline.'
- end
-
- it 'breaks the chain' do
- expect(step.break?).to be true
- end
- end
-
context 'when pipeline contains configuration validation errors' do
let(:config) { { rspec: {} } }