diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-18 12:28:32 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-18 12:28:32 +0300 |
commit | 9f7deb85b5d6937e6cf7068b864f49693b4a2623 (patch) | |
tree | 7d6805454a87d5f187086180c3bcd03e61556610 /spec/models | |
parent | 769c4a6197dfd72aca06abd20fa1ffe5c568ed24 (diff) |
Do not allow to use `CI_PIPELINE_ID` in environment name
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index e7845b693a1..0e393aa362b 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -167,6 +167,28 @@ describe Ci::Pipeline, :mailer do end end + describe '#persisted_variables' do + context 'when pipeline is not persisted yet' do + subject { build(:ci_pipeline).persisted_variables } + + it 'does not contain some variables' do + keys = subject.map { |variable| variable[:key] } + + expect(keys).not_to include 'CI_PIPELINE_ID' + end + end + + context 'when pipeline is persisted' do + subject { build_stubbed(:ci_pipeline).persisted_variables } + + it 'does not contain some variables' do + keys = subject.map { |variable| variable[:key] } + + expect(keys).to include 'CI_PIPELINE_ID' + end + end + end + describe '#predefined_variables' do subject { pipeline.predefined_variables } |