Read more

VCR: Alternative way of mocking remote APIs

Henning Koch
October 10, 2013Software engineer at makandra GmbH

If you need to test interaction with a remote API, check out the VCR gem Show archive.org snapshot as an alternative to Webmock or stubbing hell.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

The idea behind VCR is that is performs real HTTP requests and logs the interaction in a .yml file. When you run the test again, requests and responses are stubbed from the log and the test can run offline.

It's a great way to mock network requests to an external service without going through the pain of logging network traffic with Wireshark or similar tools.

Posted by Henning Koch to makandra dev (2013-10-10 10:35)