Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
29a91c5b
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,发现更多精彩内容 >>
提交
29a91c5b
编写于
8月 16, 2016
作者:
D
Douglas Barbosa Alexandre
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix matcher `match_response_schema`
上级
f77c47a5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
6 deletion
+13
-6
spec/controllers/projects/boards/issues_controller_spec.rb
spec/controllers/projects/boards/issues_controller_spec.rb
+1
-1
spec/controllers/projects/boards/lists_controller_spec.rb
spec/controllers/projects/boards/lists_controller_spec.rb
+2
-2
spec/fixtures/api/schemas/issues.json
spec/fixtures/api/schemas/issues.json
+4
-0
spec/fixtures/api/schemas/lists.json
spec/fixtures/api/schemas/lists.json
+4
-0
spec/support/api/schema_matcher.rb
spec/support/api/schema_matcher.rb
+2
-3
未找到文件。
spec/controllers/projects/boards/issues_controller_spec.rb
浏览文件 @
29a91c5b
...
...
@@ -26,7 +26,7 @@ describe Projects::Boards::IssuesController do
parsed_response
=
JSON
.
parse
(
response
.
body
)
expect
(
response
).
to
match_response_schema
(
'issue
'
,
array:
true
)
expect
(
response
).
to
match_response_schema
(
'issue
s'
)
expect
(
parsed_response
.
length
).
to
eq
2
end
end
...
...
spec/controllers/projects/boards/lists_controller_spec.rb
浏览文件 @
29a91c5b
...
...
@@ -29,7 +29,7 @@ describe Projects::Boards::ListsController do
parsed_response
=
JSON
.
parse
(
response
.
body
)
expect
(
response
).
to
match_response_schema
(
'list
'
,
array:
true
)
expect
(
response
).
to
match_response_schema
(
'list
s'
)
expect
(
parsed_response
.
length
).
to
eq
3
end
...
...
@@ -204,7 +204,7 @@ describe Projects::Boards::ListsController do
it
'returns the defaults lists'
do
generate_default_board_lists
user:
user
expect
(
response
).
to
match_response_schema
(
'list
'
,
array:
true
)
expect
(
response
).
to
match_response_schema
(
'list
s'
)
end
end
...
...
spec/fixtures/api/schemas/issues.json
0 → 100644
浏览文件 @
29a91c5b
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"issue.json"
}
}
spec/fixtures/api/schemas/lists.json
0 → 100644
浏览文件 @
29a91c5b
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"list.json"
}
}
spec/support/api/schema_matcher.rb
浏览文件 @
29a91c5b
RSpec
::
Matchers
.
define
:match_response_schema
do
|
schema
,
options
=
{}
|
RSpec
::
Matchers
.
define
:match_response_schema
do
|
schema
,
**
options
|
match
do
|
response
|
schema_directory
=
"
#{
Dir
.
pwd
}
/spec/fixtures/api/schemas"
schema_path
=
"
#{
schema_directory
}
/
#{
schema
}
.json"
list
=
options
.
fetch
(
:array
,
false
)
JSON
::
Validator
.
validate!
(
schema_path
,
response
.
body
,
list:
list
)
JSON
::
Validator
.
validate!
(
schema_path
,
response
.
body
,
options
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录