summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-23 10:13:43 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-23 10:13:43 +0100
commit8c7374cafcfe77f880d45f32ff11b38d257f5373 (patch)
treee086920a91b6b8e65f460b7450e664062bfe4644 /spec
parent8517627410499486e2bb09d8a55ba6f0088d7503 (diff)
downloadgitlab-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.rb19
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