diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/services/ci/create_pipeline_service/rules_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/services/ci/create_pipeline_service/rules_spec.rb')
-rw-r--r-- | spec/services/ci/create_pipeline_service/rules_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/services/ci/create_pipeline_service/rules_spec.rb b/spec/services/ci/create_pipeline_service/rules_spec.rb index c737b8cc329..5fdefb2b306 100644 --- a/spec/services/ci/create_pipeline_service/rules_spec.rb +++ b/spec/services/ci/create_pipeline_service/rules_spec.rb @@ -1425,5 +1425,43 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes it_behaves_like 'comparing file changes with workflow rules' end end + + context 'workflow name with rules' do + let(:ref) { 'refs/heads/feature' } + + let(:variables) do + [{ key: 'SOME_VARIABLE', secret_value: 'SOME_VAL' }] + end + + let(:pipeline) do + execute_service do |pipeline| + pipeline.variables.build(variables) + end.payload + end + + let(:config) do + <<-EOY + workflow: + name: '$PIPELINE_NAME $SOME_VARIABLE' + rules: + - if: $CI_COMMIT_REF_NAME =~ /master/ + variables: + PIPELINE_NAME: 'Name 1' + - if: $CI_COMMIT_REF_NAME =~ /feature/ + variables: + PIPELINE_NAME: 'Name 2' + + job: + stage: test + script: echo 'hello' + EOY + end + + it 'substitutes variables in pipeline name' do + expect(response).not_to be_error + expect(pipeline).to be_persisted + expect(pipeline.name).to eq('Name 2 SOME_VAL') + end + end end end |