Skip to content

Instantly share code, notes, and snippets.

@Kimtaro
Created August 22, 2013 01:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kimtaro/6302211 to your computer and use it in GitHub Desktop.
Save Kimtaro/6302211 to your computer and use it in GitHub Desktop.
Moneky patch to force Webmock to always puts when it disallows a request. This works around overly eager rescue statements hiding the Webmock NetConnectNotAllowedError.
# Encoding: UTF-8
module WebMock
class NetConnectNotAllowedError
def initialize_with_puts(request_signature)
begin
raise initialize_without_puts(request_signature)
rescue => e
puts "< ===== WEBMOCK WEBMOCK WEBMOCK WEBMOCK WEBMOCK ===== >", e.inspect
e
end
end
alias_method_chain :initialize, :puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment