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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
7c511c2f
Commit
7c511c2f
authored
Jun 29, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to set parent in CI config node
parent
2846f95d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+2
-2
lib/gitlab/ci/config/node/factory.rb
lib/gitlab/ci/config/node/factory.rb
+2
-1
spec/lib/gitlab/ci/config/node/factory_spec.rb
spec/lib/gitlab/ci/config/node/factory_spec.rb
+14
-2
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
7c511c2f
...
@@ -8,9 +8,9 @@ module Gitlab
...
@@ -8,9 +8,9 @@ module Gitlab
class
Entry
class
Entry
class
InvalidError
<
StandardError
;
end
class
InvalidError
<
StandardError
;
end
attr_reader
:config
attr_accessor
:description
attr_writer
:key
attr_writer
:key
attr_reader
:config
attr_accessor
:parent
,
:description
def
initialize
(
config
)
def
initialize
(
config
)
@config
=
config
@config
=
config
...
...
lib/gitlab/ci/config/node/factory.rb
View file @
7c511c2f
...
@@ -32,8 +32,9 @@ module Gitlab
...
@@ -32,8 +32,9 @@ module Gitlab
end
end
node
.
new
(
value
).
tap
do
|
entry
|
node
.
new
(
value
).
tap
do
|
entry
|
entry
.
description
=
@attributes
[
:description
]
entry
.
key
=
@attributes
[
:key
]
entry
.
key
=
@attributes
[
:key
]
entry
.
parent
=
@attributes
[
:parent
]
entry
.
description
=
@attributes
[
:description
]
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config/node/factory_spec.rb
View file @
7c511c2f
...
@@ -5,7 +5,7 @@ describe Gitlab::Ci::Config::Node::Factory do
...
@@ -5,7 +5,7 @@ describe Gitlab::Ci::Config::Node::Factory do
let
(
:factory
)
{
described_class
.
new
(
entry_class
)
}
let
(
:factory
)
{
described_class
.
new
(
entry_class
)
}
let
(
:entry_class
)
{
Gitlab
::
Ci
::
Config
::
Node
::
Script
}
let
(
:entry_class
)
{
Gitlab
::
Ci
::
Config
::
Node
::
Script
}
context
'when
value setting
value'
do
context
'when
setting up a
value'
do
it
'creates entry with valid value'
do
it
'creates entry with valid value'
do
entry
=
factory
entry
=
factory
.
with
(
value:
[
'ls'
,
'pwd'
])
.
with
(
value:
[
'ls'
,
'pwd'
])
...
@@ -35,9 +35,21 @@ describe Gitlab::Ci::Config::Node::Factory do
...
@@ -35,9 +35,21 @@ describe Gitlab::Ci::Config::Node::Factory do
expect
(
entry
.
key
).
to
eq
'test key'
expect
(
entry
.
key
).
to
eq
'test key'
end
end
end
end
context
'when setting a parent'
do
let
(
:parent
)
{
Object
.
new
}
it
'creates entry with valid parent'
do
entry
=
factory
.
with
(
value:
'ls'
,
parent:
parent
)
.
create!
expect
(
entry
.
parent
).
to
eq
parent
end
end
end
end
context
'when not setting value'
do
context
'when not setting
up a
value'
do
it
'raises error'
do
it
'raises error'
do
expect
{
factory
.
create!
}.
to
raise_error
(
expect
{
factory
.
create!
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Node
::
Factory
::
InvalidFactory
Gitlab
::
Ci
::
Config
::
Node
::
Factory
::
InvalidFactory
...
...
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