Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Created January 21, 2011 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheeyeo/790144 to your computer and use it in GitHub Desktop.
Save cheeyeo/790144 to your computer and use it in GitHub Desktop.
Generic webmock methods inside spec_helper.rb for rspec tests
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment