Skip to content

Clear stubs and request history

Olia Kremmyda edited this page Mar 24, 2018 · 2 revisions

Removing unused stubs

stub_get = stub_request(:get, "www.example.com")
remove_request_stub(stub_get)

If you want to reset all current stubs and history of requests use WebMock.reset!

stub_request(:any, "www.example.com")

Net::HTTP.get('www.example.com', '/')    # ===> Success

WebMock.reset!

Net::HTTP.get('www.example.com', '/')    # ===> Failure

assert_not_requested :get, "www.example.com"    # ===> Success