Disable Webmock To Make Real Requests

Jul 5, 2018

Mocking and stubbing in testing has always been my kryptonite. I know I’m not very good at it, and because of that I tend to steer clear of it when I can. Obviously not a good strategy. So I’m forcing myself to use it more.

One big thing for me is actually making an API request at times, like when building the feature, and then bypassing the request once I know it works. WebMock, while awesome, seems to hijack all requests regardless of what you are doing.

I finally put some effort into finding out how to disable it so I can ensure it works first.

Just place WebMock.disable! right in your test until you ready to start faking the requests.

If you enjoyed this and would like to be notified the next time I write something, you can subscribe with your choice of RSS or Email.

I promise not to spam you and you can unsubscribe at anytime.

Also, here are some other items you might like longer longer:

or go see everything in the archive.