Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
92312786
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
92312786
编写于
6月 29, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add CI config entry location info to error message
This CI config entry location in configuration Hash.
上级
7c511c2f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
14 deletion
+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
未找到文件。
lib/gitlab/ci/config/node/entry.rb
浏览文件 @
92312786
...
...
@@ -8,9 +8,8 @@ module Gitlab
class
Entry
class
InvalidError
<
StandardError
;
end
attr_writer
:key
attr_reader
:config
attr_accessor
:parent
,
:description
attr_accessor
:
key
,
:
parent
,
:description
def
initialize
(
config
)
@config
=
config
...
...
@@ -35,10 +34,6 @@ module Gitlab
self
.
class
.
nodes
.
none?
end
def
key
@key
||
self
.
class
.
name
.
demodulize
.
underscore
end
def
valid?
errors
.
none?
end
...
...
lib/gitlab/ci/config/node/validator.rb
浏览文件 @
92312786
...
...
@@ -8,17 +8,24 @@ module Gitlab
def
initialize
(
node
)
super
(
node
)
@node
=
node
end
def
messages
errors
.
full_messages
.
map
do
|
error
|
"
#{
key
}
#{
error
}
"
.
humanize
"
#{
location
}
#{
error
}
"
.
humanize
end
end
def
self
.
name
'Validator'
end
private
def
location
key
||
@node
.
class
.
name
.
demodulize
.
underscore
end
end
end
end
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
浏览文件 @
92312786
...
...
@@ -13,12 +13,6 @@ describe Gitlab::Ci::Config::Node::Global do
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 all entries defined'
do
let
(
:hash
)
do
...
...
spec/lib/gitlab/ci/config/node/validator_spec.rb
浏览文件 @
92312786
...
...
@@ -5,6 +5,10 @@ describe Gitlab::Ci::Config::Node::Validator do
let
(
:validator_instance
)
{
validator
.
new
(
node
)
}
let
(
:node
)
{
spy
(
'node'
)
}
before
do
allow
(
node
).
to
receive
(
:key
).
and_return
(
'node'
)
end
describe
'delegated validator'
do
before
do
validator
.
class_eval
do
...
...
@@ -42,7 +46,8 @@ describe Gitlab::Ci::Config::Node::Validator do
it
'returns errors'
do
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录