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
Léo-Paul Géneau
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
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+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
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