From f2afdc92b8029f628f6f8ed2d5b9dc1323fd3295 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 19 Dec 2016 21:09:40 +0800 Subject: [PATCH] Test if expanded_environment_name could expand var with symbols. Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8088#note_20234245 --- spec/models/build_spec.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 5a47e7ddf0d..e97f6ae3cea 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -1306,11 +1306,25 @@ describe Ci::Build, models: true do describe '#expanded_environment_name' do subject { build.expanded_environment_name } - context 'when environment uses variables' do - let(:build) { create(:ci_build, ref: 'master', environment: 'review/$CI_BUILD_REF_NAME') } + context 'when environment uses $CI_BUILD_REF_NAME' do + let(:build) do + create(:ci_build, + ref: 'master', + environment: 'review/$CI_BUILD_REF_NAME') + end it { is_expected.to eq('review/master') } end + + context 'when environment uses yaml_variables containing symbol keys' do + let(:build) do + create(:ci_build, + yaml_variables: [{key: :APP_HOST, value: 'host'}], + environment: 'review/$APP_HOST') + end + + it { is_expected.to eq('review/host') } + end end describe '#detailed_status' do