diff options
author | Rémy Coutable <remy@rymai.me> | 2017-11-27 16:58:12 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-11-27 18:09:46 +0100 |
commit | fa35ea13873f81405c5203f0827ea15703615c97 (patch) | |
tree | 2e0049dcf86d139567dfd2ac6e8d88eb0261e40f /spec/models | |
parent | 24fadd7c3d0a8f643e9df1c7ae3c1c7e88e8592e (diff) | |
download | gitlab-ce-fa35ea13873f81405c5203f0827ea15703615c97.tar.gz |
Strip leading & trailing whitespaces in CI/CD secret variable keys40561-environment-scope-value-is-not-trimmed
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/has_variable_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/concerns/has_variable_spec.rb b/spec/models/concerns/has_variable_spec.rb index f4b24e6d1d9..f87869a2fdc 100644 --- a/spec/models/concerns/has_variable_spec.rb +++ b/spec/models/concerns/has_variable_spec.rb @@ -9,6 +9,24 @@ describe HasVariable do it { is_expected.not_to allow_value('foo bar').for(:key) } it { is_expected.not_to allow_value('foo/bar').for(:key) } + describe '#key=' do + context 'when the new key is nil' do + it 'strips leading and trailing whitespaces' do + subject.key = nil + + expect(subject.key).to eq('') + end + end + + context 'when the new key has leadind and trailing whitespaces' do + it 'strips leading and trailing whitespaces' do + subject.key = ' my key ' + + expect(subject.key).to eq('my key') + end + end + end + describe '#value' do before do subject.value = 'secret' |