Commit a194b198 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make variables collection to runner mapping explicit

parent a2a8e361
......@@ -115,7 +115,7 @@ class KubernetesService < DeploymentService
collection.append(key: 'KUBE_CA_PEM_FILE', value: ca_pem, public: true, file: true)
end
variables.to_hash
variables.to_runner_variables
end
# Constructs a list of terminals from the reactive cache
......
......@@ -27,7 +27,7 @@ module Gitlab
end
end
def to_h
def to_runner_variables
self.map do |variable|
variable.to_h.reject do |key, value|
key == :file && value == false
......@@ -35,8 +35,6 @@ module Gitlab
end
end
alias_method :to_hash, :to_h
private
def fabricate(resource)
......
......@@ -52,11 +52,11 @@ describe Gitlab::Ci::Variables::Collection do
end
end
describe '#to_hash' do
it 'creates a hash / value mapping' do
describe '#to_runner_variables' do
it 'creates an array of hashes in a runner-compatible format' do
collection = described_class.new([{ key: 'TEST', value: 1 }])
expect(collection.to_hash)
expect(collection.to_runner_variables)
.to eq [{ key: 'TEST', value: 1, public: false }]
end
end
......
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