Webmock assertion that an http request was made
Webmock is a library that helps you manager the http requests that are made during a test. Its not advisable to hit production systems with test-generated requests and with webmock you can stub those requests. Sometimes to ensure functionality of your system you might want to assert that the request was made.
stub_request(:get, 'http://www.google.com')
assert_requested(:get, 'http://www.google.com')
The stub_request
method also returns a variable that can be passed to the
assert function.
get_google = stub_request(:get, 'http://www.google.com')
assert_requested get_google
Tweet