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
Jérome Perrin
gitlab-ce
Commits
30f58cf3
Commit
30f58cf3
authored
Aug 25, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add [] method for accessing ci entry dependencies
parent
4f837f66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+4
-0
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+23
-0
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
30f58cf3
...
...
@@ -20,6 +20,10 @@ module Gitlab
@validator
.
validate
(
:new
)
end
def
[]
(
key
)
@entries
[
key
]
||
Node
::
Undefined
.
new
end
def
compose!
(
deps
=
nil
)
return
unless
valid?
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
30f58cf3
...
...
@@ -253,4 +253,27 @@ describe Gitlab::Ci::Config::Node::Global do
expect
(
global
.
specified?
).
to
be
true
end
end
describe
'#[]'
do
before
{
global
.
compose!
}
let
(
:hash
)
do
{
cache:
{
key:
'a'
},
rspec:
{
script:
'ls'
}
}
end
context
'when node exists'
do
it
'returns correct entry'
do
expect
(
global
[
:cache
])
.
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Cache
expect
(
global
[
:jobs
][
:rspec
][
:script
].
value
).
to
eq
[
'ls'
]
end
end
context
'when node does not exist'
do
it
'always return unspecified node'
do
expect
(
global
[
:some
][
:unknown
][
:node
])
.
not_to
be_specified
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