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
29a91c5b
Commit
29a91c5b
authored
Aug 16, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix matcher `match_response_schema`
parent
f77c47a5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
issues_controller_spec.rb
spec/controllers/projects/boards/issues_controller_spec.rb
+1
-1
lists_controller_spec.rb
spec/controllers/projects/boards/lists_controller_spec.rb
+2
-2
issues.json
spec/fixtures/api/schemas/issues.json
+4
-0
lists.json
spec/fixtures/api/schemas/lists.json
+4
-0
schema_matcher.rb
spec/support/api/schema_matcher.rb
+2
-3
No files found.
spec/controllers/projects/boards/issues_controller_spec.rb
View file @
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
View file @
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
View file @
29a91c5b
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"issue.json"
}
}
spec/fixtures/api/schemas/lists.json
0 → 100644
View file @
29a91c5b
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"list.json"
}
}
spec/support/api/schema_matcher.rb
View file @
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
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