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
a00520b1
Commit
a00520b1
authored
Mar 03, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore Unspecified and we could discuss later
Also feedback in:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9666/diffs#note_24608283
parent
dc3a41f4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
19 deletions
+57
-19
factory.rb
lib/gitlab/ci/config/entry/factory.rb
+3
-1
node.rb
lib/gitlab/ci/config/entry/node.rb
+3
-18
unspecified.rb
lib/gitlab/ci/config/entry/unspecified.rb
+19
-0
unspecified_spec.rb
spec/lib/gitlab/ci/config/entry/unspecified_spec.rb
+32
-0
No files found.
lib/gitlab/ci/config/entry/factory.rb
View file @
a00520b1
...
@@ -37,7 +37,9 @@ module Gitlab
...
@@ -37,7 +37,9 @@ module Gitlab
# See issue #18775.
# See issue #18775.
#
#
if
@value
.
nil?
if
@value
.
nil?
Entry
::
Unspecified
.
new
(
fabricate_unspecified
fabricate_unspecified
)
else
else
fabricate
(
@entry
,
@value
)
fabricate
(
@entry
,
@value
)
end
end
...
@@ -54,7 +56,7 @@ module Gitlab
...
@@ -54,7 +56,7 @@ module Gitlab
fabricate
(
Entry
::
Undefined
)
fabricate
(
Entry
::
Undefined
)
else
else
fabricate
(
@entry
,
@entry
.
default
)
fabricate
(
@entry
,
@entry
.
default
)
end
.
tap
(
&
:unspecify
)
end
end
end
def
fabricate
(
entry
,
value
=
nil
)
def
fabricate
(
entry
,
value
=
nil
)
...
...
lib/gitlab/ci/config/entry/node.rb
View file @
a00520b1
...
@@ -15,7 +15,6 @@ module Gitlab
...
@@ -15,7 +15,6 @@ module Gitlab
@config
=
config
@config
=
config
@metadata
=
metadata
@metadata
=
metadata
@entries
=
{}
@entries
=
{}
@specified
=
true
@validator
=
self
.
class
.
validator
.
new
(
self
)
@validator
=
self
.
class
.
validator
.
new
(
self
)
@validator
.
validate
(
:new
)
@validator
.
validate
(
:new
)
...
@@ -63,12 +62,8 @@ module Gitlab
...
@@ -63,12 +62,8 @@ module Gitlab
end
end
end
end
def
unspecify
@specified
=
false
end
def
specified?
def
specified?
@specified
true
end
end
def
relevant?
def
relevant?
...
@@ -76,18 +71,8 @@ module Gitlab
...
@@ -76,18 +71,8 @@ module Gitlab
end
end
def
inspect
def
inspect
val
=
if
leaf?
val
=
leaf?
?
config
:
descendants
config
unspecified
=
specified?
?
''
:
'(unspecified) '
else
descendants
end
unspecified
=
if
specified?
''
else
'(unspecified) '
end
"#<
#{
self
.
class
.
name
}
#{
unspecified
}
{
#{
key
}
:
#{
val
.
inspect
}
}>"
"#<
#{
self
.
class
.
name
}
#{
unspecified
}
{
#{
key
}
:
#{
val
.
inspect
}
}>"
end
end
...
...
lib/gitlab/ci/config/entry/unspecified.rb
0 → 100644
View file @
a00520b1
module
Gitlab
module
Ci
class
Config
module
Entry
##
# This class represents an unspecified entry.
#
# It decorates original entry adding method that indicates it is
# unspecified.
#
class
Unspecified
<
SimpleDelegator
def
specified?
false
end
end
end
end
end
end
spec/lib/gitlab/ci/config/entry/unspecified_spec.rb
0 → 100644
View file @
a00520b1
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Entry
::
Unspecified
do
let
(
:unspecified
)
{
described_class
.
new
(
entry
)
}
let
(
:entry
)
{
spy
(
'Entry'
)
}
describe
'#valid?'
do
it
'delegates method to entry'
do
expect
(
unspecified
.
valid?
).
to
eq
entry
end
end
describe
'#errors'
do
it
'delegates method to entry'
do
expect
(
unspecified
.
errors
).
to
eq
entry
end
end
describe
'#value'
do
it
'delegates method to entry'
do
expect
(
unspecified
.
value
).
to
eq
entry
end
end
describe
'#specified?'
do
it
'is always false'
do
allow
(
entry
).
to
receive
(
:specified?
).
and_return
(
true
)
expect
(
unspecified
.
specified?
).
to
be
false
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