Skip to content
代码片段 群组 项目
提交 fd4fd25d 编辑于 作者: Grzegorz Bizon's avatar Grzegorz Bizon
浏览文件

Fix passing a hash with string keys when fabricating a variable

上级 3779d76d
No related branches found
No related tags found
无相关合并请求
......@@ -34,7 +34,7 @@ def to_runner_variable
def self.fabricate(resource)
case resource
when Hash
self.new(resource)
self.new(resource.symbolize_keys)
when ::HasVariable
self.new(resource.to_runner_variable)
when self
......
......@@ -75,6 +75,14 @@
expect(resource).to eq variable
end
it 'supports using a hash with stringified values' do
variable = { 'key' => 'VARIABLE', 'value' => 'my value' }
resource = described_class.fabricate(variable)
expect(resource).to eq(key: 'VARIABLE', value: 'my value')
end
it 'supports using an active record resource' do
variable = create(:ci_variable, key: 'CI_VAR', value: '123')
resource = described_class.fabricate(variable)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册