Commit d532a9cb authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add variables to pipeline expressions evaluator

parent 35354826
......@@ -17,7 +17,10 @@ module Gitlab
def initialize(statement, pipeline)
@pipeline = pipeline
@lexer = Expression::Lexer.new(statement)
@variables = pipeline.variables # TODO
@variables = pipeline.variables.map do |variable|
{ variable.key => variable.value }
end
end
def tokens
......
......@@ -8,6 +8,10 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do
described_class.new(text, pipeline)
end
before do
pipeline.variables.build([key: 'VARIABLE', value: 'my variable'])
end
describe '#tokens' do
it 'returns raw tokens' do
expect(subject.tokens.size).to eq 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment