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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4f0fa13e
Commit
4f0fa13e
authored
Aug 11, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show error message for API 500 error in tests, and
document have_gitlab_http_status
parent
c62ae6cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
doc/development/testing.md
doc/development/testing.md
+9
-0
lib/api/helpers.rb
lib/api/helpers.rb
+9
-1
No files found.
doc/development/testing.md
View file @
4f0fa13e
...
@@ -270,6 +270,15 @@ complexity of RSpec expectations.They should be placed under
...
@@ -270,6 +270,15 @@ complexity of RSpec expectations.They should be placed under
a certain type of specs only (e.g. features, requests etc.) but shouldn't be if
a certain type of specs only (e.g. features, requests etc.) but shouldn't be if
they apply to multiple type of specs.
they apply to multiple type of specs.
#### have_gitlab_http_status
Prefer
`have_gitlab_http_status`
over
`have_http_status`
because the former
could also show the response body whenever the status mismatched. This would
be very useful whenever some tests start breaking and we would love to know
why without editing the source and rerun the tests.
This is especially useful whenever it's showing 500 internal server error.
### Shared contexts
### Shared contexts
All shared contexts should be be placed under
`spec/support/shared_contexts/`
.
All shared contexts should be be placed under
`spec/support/shared_contexts/`
.
...
...
lib/api/helpers.rb
View file @
4f0fa13e
...
@@ -257,7 +257,15 @@ module API
...
@@ -257,7 +257,15 @@ module API
message
<<
" "
<<
trace
.
join
(
"
\n
"
)
message
<<
" "
<<
trace
.
join
(
"
\n
"
)
API
.
logger
.
add
Logger
::
FATAL
,
message
API
.
logger
.
add
Logger
::
FATAL
,
message
rack_response
({
'message'
=>
'500 Internal Server Error'
}.
to_json
,
500
)
response_message
=
if
Rails
.
env
.
test?
message
else
'500 Internal Server Error'
end
rack_response
({
'message'
=>
response_message
}.
to_json
,
500
)
end
end
# project helpers
# project helpers
...
...
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