summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-27 13:36:30 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-27 13:36:30 +0200
commit3ab013634da1713179ff8c94f6b698f558af226d (patch)
treec8c57bb571a625819ae5a67e942464a0adaf2438
parentda6bfd9b801c4d1c91593c6b4a755b097b644ab0 (diff)
downloadgitlab-ce-3ab013634da1713179ff8c94f6b698f558af226d.tar.gz
Add test for evaluating secret variables in a policy
-rw-r--r--spec/lib/gitlab/ci/build/policy/variables_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/build/policy/variables_spec.rb b/spec/lib/gitlab/ci/build/policy/variables_spec.rb
index 5bbe4348ed4..a66a9144a16 100644
--- a/spec/lib/gitlab/ci/build/policy/variables_spec.rb
+++ b/spec/lib/gitlab/ci/build/policy/variables_spec.rb
@@ -48,13 +48,21 @@ describe Gitlab::Ci::Build::Policy::Variables do
expect(policy).to be_satisfied_by(pipeline, seed)
end
+ it 'allows to evaluate regular secret variables' do
+ secret = create(:ci_variable, project: project,
+ key: 'SECRET',
+ value: 'secret value')
+
+ policy = described_class.new(["$SECRET == 'secret value'"])
+
+ expect(policy).to be_satisfied_by(pipeline, seed)
+ end
+
it 'does not persist neither pipeline nor build' do
described_class.new('$VAR').satisfied_by?(pipeline, seed)
expect(pipeline).not_to be_persisted
expect(seed.to_resource).not_to be_persisted
end
-
- pending 'test for secret variables'
end
end