Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-11-27 18:58:12 +0300
committerRémy Coutable <remy@rymai.me>2017-11-27 20:09:46 +0300
commitfa35ea13873f81405c5203f0827ea15703615c97 (patch)
tree2e0049dcf86d139567dfd2ac6e8d88eb0261e40f /spec
parent24fadd7c3d0a8f643e9df1c7ae3c1c7e88e8592e (diff)
Strip leading & trailing whitespaces in CI/CD secret variable keys
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/has_variable_spec.rb18
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'