BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0015fc7d
Unverified
Commit
0015fc7d
authored
Apr 12, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/10-7-stable' into 10-7-stable-prepare-rc5
parents
24a654db
c393a44f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
VERSION
VERSION
+1
-1
item.rb
lib/gitlab/ci/variables/collection/item.rb
+2
-5
item_spec.rb
spec/lib/gitlab/ci/variables/collection/item_spec.rb
+30
-5
No files found.
VERSION
View file @
0015fc7d
10.7.0-rc
3
10.7.0-rc
4
lib/gitlab/ci/variables/collection/item.rb
View file @
0015fc7d
...
...
@@ -3,12 +3,9 @@ module Gitlab
module
Variables
class
Collection
class
Item
def
initialize
(
**
options
)
def
initialize
(
key
:,
value
:,
public:
true
,
file:
false
)
@variable
=
{
key:
options
.
fetch
(
:key
),
value:
options
.
fetch
(
:value
),
public:
options
.
fetch
(
:public
,
true
),
file:
options
.
fetch
(
:files
,
false
)
key:
key
,
value:
value
,
public:
public
,
file:
file
}
end
...
...
spec/lib/gitlab/ci/variables/collection/item_spec.rb
View file @
0015fc7d
...
...
@@ -5,6 +5,18 @@ describe Gitlab::Ci::Variables::Collection::Item do
{
key:
'VAR'
,
value:
'something'
,
public:
true
}
end
describe
'.new'
do
it
'raises error if unknown key i specified'
do
expect
{
described_class
.
new
(
key:
'VAR'
,
value:
'abc'
,
files:
true
)
}
.
to
raise_error
ArgumentError
,
'unknown keyword: files'
end
it
'raises error when required keywords are not specified'
do
expect
{
described_class
.
new
(
key:
'VAR'
)
}
.
to
raise_error
ArgumentError
,
'missing keyword: value'
end
end
describe
'.fabricate'
do
it
'supports using a hash'
do
resource
=
described_class
.
fabricate
(
variable
)
...
...
@@ -47,12 +59,25 @@ describe Gitlab::Ci::Variables::Collection::Item do
end
describe
'#to_runner_variable'
do
it
'returns a runner-compatible hash representation'
do
runner_variable
=
described_class
.
new
(
**
variable
)
.
to_runner_variable
context
'when variable is not a file-related'
do
it
'returns a runner-compatible hash representation'
do
runner_variable
=
described_class
.
new
(
**
variable
)
.
to_runner_variable
expect
(
runner_variable
).
to
eq
variable
end
end
context
'when variable is file-related'
do
it
'appends file description component'
do
runner_variable
=
described_class
.
new
(
key:
'VAR'
,
value:
'value'
,
file:
true
)
.
to_runner_variable
expect
(
runner_variable
).
to
eq
variable
expect
(
runner_variable
)
.
to
eq
(
key:
'VAR'
,
value:
'value'
,
public:
true
,
file:
true
)
end
end
end
end
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