diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-23 10:13:43 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-02-23 10:13:43 +0100 |
commit | 8c7374cafcfe77f880d45f32ff11b38d257f5373 (patch) | |
tree | e086920a91b6b8e65f460b7450e664062bfe4644 /spec | |
parent | 8517627410499486e2bb09d8a55ba6f0088d7503 (diff) | |
download | gitlab-ce-8c7374cafcfe77f880d45f32ff11b38d257f5373.tar.gz |
Add operator / value types in pipeline expressions
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb b/spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb index 672ee9d75c0..e8a1fc0579e 100644 --- a/spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb @@ -23,11 +23,20 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do end context 'when expression grammar is incorrect' do - let(:text) { '$VAR "text"' } - - it 'raises an error' do - expect { subject.parse_tree } - .to raise_error described_class::StatementError + table = [ + '$VAR "text"', # missing operator + '== "123"', # invalid right side + "'single quotes'", # single quotes string + '$VAR ==', # invalid right side + '12345', # unknown syntax + '' # empty statement + ] + + table.each do |syntax| + it "raises an error when syntax is `#{syntax}`" do + expect { described_class.new(syntax, pipeline).parse_tree } + .to raise_error described_class::StatementError + end end end |