Skip to content

Instantly share code, notes, and snippets.

@javiervidal
Created April 11, 2025 11:18
Show Gist options
  • Save javiervidal/bb70bf4ad2afad4946eeda249fa9bf19 to your computer and use it in GitHub Desktop.
Save javiervidal/bb70bf4ad2afad4946eeda249fa9bf19 to your computer and use it in GitHub Desktop.
Log external requests in tests
WebMock.allow_net_connect!
WebMock.after_request do |request_signature, response|
stubbing_instructions =
WebMock::RequestSignatureSnippet
.new(request_signature)
.stubbing_instructions
puts '===== outgoing request ======================='
puts stubbing_instructions
puts
puts "response status: #{response.status.inspect}"
puts 'body:'
puts
puts response.body
puts '=============================================='
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment