Commit a60ccef9 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs for method that exposes build variables hash

parent 3ab01363
...@@ -288,9 +288,6 @@ module Ci ...@@ -288,9 +288,6 @@ module Ci
.to_runner_variables .to_runner_variables
end end
##
# TODO, add specs
#
def variables_hash def variables_hash
scoped_variables.to_hash scoped_variables.to_hash
end end
......
...@@ -2053,6 +2053,18 @@ describe Ci::Build do ...@@ -2053,6 +2053,18 @@ describe Ci::Build do
end end
end end
describe '#variables_hash' do
before do
project.variables.create!(key: 'MY_VAR', value: 'my value 1')
pipeline.variables.create!(key: 'MY_VAR', value: 'my value 2')
end
it 'returns a regular hash created in valid order' do
expect(build.variables_hash).to include('MY_VAR': 'my value 2')
expect(build.variables_hash).not_to include('MY_VAR': 'my value 1')
end
end
describe 'state transition: any => [:pending]' do describe 'state transition: any => [:pending]' do
let(:build) { create(:ci_build, :created) } let(:build) { create(:ci_build, :created) }
......
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