public
Last active

Generic webmock methods inside spec_helper.rb for rspec tests

  • Download Gist
webmock_helpers.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# inside spec_helper.rb
def enable_http_request
WebMock.reset!
WebMock.allow_net_connect!
end
def disable_http_request
WebMock.reset!
WebMock.disable_net_connect!
end
 
# usage inside your own spec files
 
# before do
# enable_http_request
# end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.