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