mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
DEV: Catch Mocha::ExpectationError in request specs (#14897)
Same issue as 28b00dc6fc
, the
Mocha::ExpectationError inherits from Exception instead
of StandardError so RspecErrorTracker does not show the
actual failed expectation in request specs, the status of
the response is just 500 with no further detail.
This commit is contained in:
parent
2371da9f25
commit
e0be6ce1ee
@ -46,9 +46,9 @@ class RspecErrorTracker
|
||||
@app.call(env)
|
||||
|
||||
# This is a little repetitive, but since WebMock::NetConnectNotAllowedError
|
||||
# inherits from Exception instead of StandardError it does not get captured
|
||||
# by the rescue => e shorthand :(
|
||||
rescue WebMock::NetConnectNotAllowedError, StandardError => e
|
||||
# and also Mocha::ExpectationError inherit from Exception instead of StandardError
|
||||
# they do not get captured by the rescue => e shorthand :(
|
||||
rescue WebMock::NetConnectNotAllowedError, Mocha::ExpectationError, StandardError => e
|
||||
RspecErrorTracker.last_exception = e
|
||||
raise e
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user