diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-17 13:44:46 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-17 13:44:46 +0300 |
commit | 8b3e21b66b734b38e88f63727ee77b978ea21bfc (patch) | |
tree | 9efe779dd20e8ee002cb6b0df2f77c0e6a0d53ee /spec/lib/gitlab/ci/config/entry/policy_spec.rb | |
parent | a1f1e08670a7f8bd5499e16c778be16106210a44 (diff) |
Add variables expression pattern validation support
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/policy_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/policy_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/policy_spec.rb b/spec/lib/gitlab/ci/config/entry/policy_spec.rb index 08718c382b9..83d39b82068 100644 --- a/spec/lib/gitlab/ci/config/entry/policy_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/policy_spec.rb @@ -111,7 +111,15 @@ describe Gitlab::Ci::Config::Entry::Policy do context 'when specifying invalid variables expressions token' do let(:config) { { variables: ['$MY_VAR == 123'] } } - it 'reports an error about invalid statement' do + it 'reports an error about invalid expression' do + expect(entry.errors).to include /invalid expression syntax/ + end + end + + context 'when using invalid variables expressions regexp' do + let(:config) { { variables: ['$MY_VAR =~ /some ( thing/'] } } + + it 'reports an error about invalid expression' do expect(entry.errors).to include /invalid expression syntax/ end end |