Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-19 15:00:35 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-19 15:00:35 +0300
commitf84d3dc0ee9131ce1ab8716b833764d40c025eee (patch)
treefdadb4a4e066b48ec5eacaa6c84a24cf9c6eaa5c /spec/models/ci
parent59eb9938f66f8c24770b06f4d435e4df0acef252 (diff)
Fix deserializing yaml variables in imported projects
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index ee923374480..e7bca70b548 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2269,6 +2269,34 @@ describe Ci::Build do
end
end
+ describe '#yaml_variables' do
+ before do
+ build.update_attribute(:yaml_variables, variables)
+ end
+
+ context 'when serialized valu is a symbolized hash' do
+ let(:variables) do
+ [{ key: :VARIABLE, value: 'my value 1' }]
+ end
+
+ it 'keeps symbolizes keys and stringifies variables names' do
+ expect(build.yaml_variables)
+ .to eq [{ key: 'VARIABLE', value: 'my value 1' }]
+ end
+ end
+
+ context 'when serialized value is a hash with string keys' do
+ let(:variables) do
+ [{'key' => :VARIABLE, 'value' => 'my value 2' }]
+ end
+
+ it 'symblizes variables hash' do
+ expect(build.yaml_variables)
+ .to eq [{ key: 'VARIABLE', value: 'my value 2' }]
+ end
+ end
+ end
+
describe 'state transition: any => [:pending]' do
let(:build) { create(:ci_build, :created) }