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
Léo-Paul Géneau
gitlab-ce
Commits
56a01151
Commit
56a01151
authored
Nov 22, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to store null variables
parent
2e3dab38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
lib/gitlab/ci/variables/collection/item.rb
lib/gitlab/ci/variables/collection/item.rb
+2
-2
spec/lib/gitlab/ci/variables/collection/item_spec.rb
spec/lib/gitlab/ci/variables/collection/item_spec.rb
+2
-2
No files found.
lib/gitlab/ci/variables/collection/item.rb
View file @
56a01151
...
...
@@ -6,8 +6,8 @@ module Gitlab
class
Collection
class
Item
def
initialize
(
key
:,
value
:,
public:
true
,
file:
false
)
raise
ArgumentError
,
"`
#{
key
}
` must be of type String, while it was:
#{
value
.
class
}
"
unless
value
.
is_a?
(
String
)
raise
ArgumentError
,
"`
#{
key
}
` must be of type String
or nil value
, while it was:
#{
value
.
class
}
"
unless
value
.
is_a?
(
String
)
||
value
.
nil?
@variable
=
{
key:
key
,
value:
value
,
public:
public
,
file:
file
...
...
spec/lib/gitlab/ci/variables/collection/item_spec.rb
View file @
56a01151
...
...
@@ -36,7 +36,7 @@ describe Gitlab::Ci::Variables::Collection::Item do
shared_examples
'raises error for invalid type'
do
it
do
expect
{
described_class
.
new
(
key:
variable_key
,
value:
variable_value
)
}
.
to
raise_error
ArgumentError
,
/`
#{
variable_key
}
` must be of type String, while it was:/
.
to
raise_error
ArgumentError
,
/`
#{
variable_key
}
` must be of type String
or nil value
, while it was:/
end
end
...
...
@@ -46,7 +46,7 @@ describe Gitlab::Ci::Variables::Collection::Item do
let
(
:variable_value
)
{
nil
}
let
(
:expected_value
)
{
nil
}
it_behaves_like
'
raises error for invalid typ
e'
it_behaves_like
'
creates variabl
e'
end
context
"when it's an empty string"
do
...
...
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