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
04ecfca3
Commit
04ecfca3
authored
Jun 22, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename CI config null node entry to undefined node
parent
97ec24f0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
23 deletions
+16
-23
configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+1
-1
factory.rb
lib/gitlab/ci/config/node/factory.rb
+2
-4
undefined.rb
lib/gitlab/ci/config/node/undefined.rb
+6
-11
factory_spec.rb
spec/lib/gitlab/ci/config/node/factory_spec.rb
+3
-3
undefined_spec.rb
spec/lib/gitlab/ci/config/node/undefined_spec.rb
+4
-4
No files found.
lib/gitlab/ci/config/node/configurable.rb
View file @
04ecfca3
...
...
@@ -27,7 +27,7 @@ module Gitlab
def
create_node
(
key
,
factory
)
factory
.
with
(
value:
@config
[
key
],
key:
key
)
factory
.
nullify
!
unless
@config
.
has_key?
(
key
)
factory
.
undefine
!
unless
@config
.
has_key?
(
key
)
factory
.
create!
end
...
...
lib/gitlab/ci/config/node/factory.rb
View file @
04ecfca3
...
...
@@ -5,8 +5,6 @@ module Gitlab
##
# Factory class responsible for fabricating node entry objects.
#
# It uses Fluent Interface pattern to set all necessary attributes.
#
class
Factory
class
InvalidFactory
<
StandardError
;
end
...
...
@@ -20,8 +18,8 @@ module Gitlab
self
end
def
nullify
!
@entry_class
=
Node
::
Null
def
undefine
!
@entry_class
=
Node
::
Undefined
self
end
...
...
lib/gitlab/ci/config/node/
null
.rb
→
lib/gitlab/ci/config/node/
undefined
.rb
View file @
04ecfca3
...
...
@@ -3,20 +3,15 @@ module Gitlab
class
Config
module
Node
##
# This class represents a configuration entry that is not
being us
ed
# This class represents a configuration entry that is not
defin
ed
# in configuration file.
#
# This implements Null Object pattern.
# This implements
a
Null Object pattern.
#
class
Null
<
Entry
def
value
nil
end
def
validate!
nil
end
# It can be initialized using a default value of entry that is not
# present in configuration.
#
class
Undefined
<
Entry
def
method_missing
(
*
)
nil
end
...
...
spec/lib/gitlab/ci/config/node/factory_spec.rb
View file @
04ecfca3
...
...
@@ -45,14 +45,14 @@ describe Gitlab::Ci::Config::Node::Factory do
end
end
context
'when creating
a null
entry'
do
context
'when creating
undefined
entry'
do
it
'creates a null entry'
do
entry
=
factory
.
with
(
value:
nil
)
.
nullify
!
.
undefine
!
.
create!
expect
(
entry
).
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Null
expect
(
entry
).
to
be_an_instance_of
Gitlab
::
Ci
::
Config
::
Node
::
Undefined
end
end
end
...
...
spec/lib/gitlab/ci/config/node/
null
_spec.rb
→
spec/lib/gitlab/ci/config/node/
undefined
_spec.rb
View file @
04ecfca3
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Node
::
Null
do
let
(
:entry
)
{
described_class
.
new
(
nil
)
}
describe
Gitlab
::
Ci
::
Config
::
Node
::
Undefined
do
let
(
:entry
)
{
described_class
.
new
(
'some value'
)
}
describe
'#leaf?'
do
it
'is leaf node'
do
...
...
@@ -16,8 +16,8 @@ describe Gitlab::Ci::Config::Node::Null do
end
describe
'#value'
do
it
'returns
nil
'
do
expect
(
entry
.
value
).
to
be
nil
it
'returns
configured value
'
do
expect
(
entry
.
value
).
to
eq
'some value'
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