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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
20 deletions
+58
-20
factory.rb
lib/gitlab/ci/config/entry/factory.rb
+4
-2
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
# See issue #18775.
#
if
@value
.
nil?
fabricate_unspecified
Entry
::
Unspecified
.
new
(
fabricate_unspecified
)
else
fabricate
(
@entry
,
@value
)
end
...
...
@@ -54,7 +56,7 @@ module Gitlab
fabricate
(
Entry
::
Undefined
)
else
fabricate
(
@entry
,
@entry
.
default
)
end
.
tap
(
&
:unspecify
)
end
end
def
fabricate
(
entry
,
value
=
nil
)
...
...
lib/gitlab/ci/config/entry/node.rb
View file @
a00520b1
...
...
@@ -15,7 +15,6 @@ module Gitlab
@config
=
config
@metadata
=
metadata
@entries
=
{}
@specified
=
true
@validator
=
self
.
class
.
validator
.
new
(
self
)
@validator
.
validate
(
:new
)
...
...
@@ -63,12 +62,8 @@ module Gitlab
end
end
def
unspecify
@specified
=
false
end
def
specified?
@specified
true
end
def
relevant?
...
...
@@ -76,18 +71,8 @@ module Gitlab
end
def
inspect
val
=
if
leaf?
config
else
descendants
end
unspecified
=
if
specified?
''
else
'(unspecified) '
end
val
=
leaf?
?
config
:
descendants
unspecified
=
specified?
?
''
:
'(unspecified) '
"#<
#{
self
.
class
.
name
}
#{
unspecified
}
{
#{
key
}
:
#{
val
.
inspect
}
}>"
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