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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
92312786
Commit
92312786
authored
Jun 29, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CI config entry location info to error message
This CI config entry location in configuration Hash.
parent
7c511c2f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+1
-6
lib/gitlab/ci/config/node/validator.rb
lib/gitlab/ci/config/node/validator.rb
+8
-1
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+0
-6
spec/lib/gitlab/ci/config/node/validator_spec.rb
spec/lib/gitlab/ci/config/node/validator_spec.rb
+6
-1
No files found.
lib/gitlab/ci/config/node/entry.rb
View file @
92312786
...
@@ -8,9 +8,8 @@ module Gitlab
...
@@ -8,9 +8,8 @@ module Gitlab
class
Entry
class
Entry
class
InvalidError
<
StandardError
;
end
class
InvalidError
<
StandardError
;
end
attr_writer
:key
attr_reader
:config
attr_reader
:config
attr_accessor
:parent
,
:description
attr_accessor
:
key
,
:
parent
,
:description
def
initialize
(
config
)
def
initialize
(
config
)
@config
=
config
@config
=
config
...
@@ -35,10 +34,6 @@ module Gitlab
...
@@ -35,10 +34,6 @@ module Gitlab
self
.
class
.
nodes
.
none?
self
.
class
.
nodes
.
none?
end
end
def
key
@key
||
self
.
class
.
name
.
demodulize
.
underscore
end
def
valid?
def
valid?
errors
.
none?
errors
.
none?
end
end
...
...
lib/gitlab/ci/config/node/validator.rb
View file @
92312786
...
@@ -8,17 +8,24 @@ module Gitlab
...
@@ -8,17 +8,24 @@ module Gitlab
def
initialize
(
node
)
def
initialize
(
node
)
super
(
node
)
super
(
node
)
@node
=
node
end
end
def
messages
def
messages
errors
.
full_messages
.
map
do
|
error
|
errors
.
full_messages
.
map
do
|
error
|
"
#{
key
}
#{
error
}
"
.
humanize
"
#{
location
}
#{
error
}
"
.
humanize
end
end
end
end
def
self
.
name
def
self
.
name
'Validator'
'Validator'
end
end
private
def
location
key
||
@node
.
class
.
name
.
demodulize
.
underscore
end
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
92312786
...
@@ -13,12 +13,6 @@ describe Gitlab::Ci::Config::Node::Global do
...
@@ -13,12 +13,6 @@ describe Gitlab::Ci::Config::Node::Global do
end
end
end
end
describe
'#key'
do
it
'returns underscored class name'
do
expect
(
global
.
key
).
to
eq
'global'
end
end
context
'when hash is valid'
do
context
'when hash is valid'
do
context
'when all entries defined'
do
context
'when all entries defined'
do
let
(
:hash
)
do
let
(
:hash
)
do
...
...
spec/lib/gitlab/ci/config/node/validator_spec.rb
View file @
92312786
...
@@ -5,6 +5,10 @@ describe Gitlab::Ci::Config::Node::Validator do
...
@@ -5,6 +5,10 @@ describe Gitlab::Ci::Config::Node::Validator do
let
(
:validator_instance
)
{
validator
.
new
(
node
)
}
let
(
:validator_instance
)
{
validator
.
new
(
node
)
}
let
(
:node
)
{
spy
(
'node'
)
}
let
(
:node
)
{
spy
(
'node'
)
}
before
do
allow
(
node
).
to
receive
(
:key
).
and_return
(
'node'
)
end
describe
'delegated validator'
do
describe
'delegated validator'
do
before
do
before
do
validator
.
class_eval
do
validator
.
class_eval
do
...
@@ -42,7 +46,8 @@ describe Gitlab::Ci::Config::Node::Validator do
...
@@ -42,7 +46,8 @@ describe Gitlab::Ci::Config::Node::Validator do
it
'returns errors'
do
it
'returns errors'
do
validator_instance
.
validate
validator_instance
.
validate
expect
(
validator_instance
.
messages
).
not_to
be_empty
expect
(
validator_instance
.
messages
)
.
to
include
"Node test attribute can't be blank"
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