diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 15:11:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-07 15:11:44 +0300 |
commit | 1dab074ef1740798bcba5f8468b09e5f378fe0f4 (patch) | |
tree | 054814248c286b8bfeeca8e331113485cf32b088 /spec/presenters | |
parent | bc9a474793f7b9dca48b8aa29661039d75673d0c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/ci/build_runner_presenter_spec.rb | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/spec/presenters/ci/build_runner_presenter_spec.rb b/spec/presenters/ci/build_runner_presenter_spec.rb index 845ae79c497..952de121cc4 100644 --- a/spec/presenters/ci/build_runner_presenter_spec.rb +++ b/spec/presenters/ci/build_runner_presenter_spec.rb @@ -325,7 +325,7 @@ RSpec.describe Ci::BuildRunnerPresenter do is_expected.to eq(presenter.variables.to_runner_variables) end - context 'when there are variables to expand' do + context 'when there is a file variable to expand' do before_all do create(:ci_variable, project: project, key: 'regular_var', @@ -360,6 +360,49 @@ RSpec.describe Ci::BuildRunnerPresenter do runner_variables end end + + context 'when there is a raw variable to expand' do + before_all do + create(:ci_variable, project: project, + key: 'regular_var', + value: 'value 1') + create(:ci_variable, project: project, + key: 'raw_var', + value: 'value 2', + raw: true) + create(:ci_variable, project: project, + key: 'var_with_variables', + value: 'value 3 and $regular_var and $raw_var and $undefined_var') + end + + it 'returns expanded variables without expanding raws' do + expect(runner_variables).to include( + { key: 'regular_var', value: 'value 1', + public: false, masked: false }, + { key: 'raw_var', value: 'value 2', + public: false, masked: false, raw: true }, + { key: 'var_with_variables', value: 'value 3 and value 1 and $raw_var and $undefined_var', + public: false, masked: false } + ) + end + + context 'when the FF ci_raw_variables_in_yaml_config is disabled' do + before do + stub_feature_flags(ci_raw_variables_in_yaml_config: false) + end + + it 'returns expanded variables' do + expect(runner_variables).to include( + { key: 'regular_var', value: 'value 1', + public: false, masked: false }, + { key: 'raw_var', value: 'value 2', + public: false, masked: false, raw: true }, + { key: 'var_with_variables', value: 'value 3 and value 1 and value 2 and $undefined_var', + public: false, masked: false } + ) + end + end + end end describe '#runner_variables subset' do |