Routing all requests to Rails via WebMock during tests

WebMock allows you to route all HTTP requests made during tests to a rack app with to_rack. You can use this method to route the same traffic to a Rails app as well.

stub_request(:any, /account.envato.com/).to_rack(Rails.application)  

Rails.application is the rack object in a Rails app.