Skip to content

A platform for community discussion. Free, open, simple.

DEV: Output webmock errors in request specs (#14782)

Martin Brennan28b00dc6fc4f
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 61523bc2d7e..1a68ce59bb7 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -44,7 +44,11 @@ class RspecErrorTracker
def call(env)
begin
@app.call(env)
- rescue => e
+
+ # 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
RspecErrorTracker.last_exception = e
raise e
end