Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
fd4fd25d
Commit
fd4fd25d
authored
Jul 19, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix passing a hash with string keys when fabricating a variable
parent
3779d76d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
lib/gitlab/ci/variables/collection/item.rb
lib/gitlab/ci/variables/collection/item.rb
+1
-1
spec/lib/gitlab/ci/variables/collection/item_spec.rb
spec/lib/gitlab/ci/variables/collection/item_spec.rb
+8
-0
No files found.
lib/gitlab/ci/variables/collection/item.rb
View file @
fd4fd25d
...
...
@@ -34,7 +34,7 @@ module Gitlab
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
...
...
spec/lib/gitlab/ci/variables/collection/item_spec.rb
View file @
fd4fd25d
...
...
@@ -75,6 +75,14 @@ describe Gitlab::Ci::Variables::Collection::Item do
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment