O'Reilly logo

Take My Money by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing with the VCR Gem

There’s one more step to cover while we are still talking about this payment example: testing—specifically, testing our interaction with third-party services. Testing third-party services is hard because they are traditionally located across the network from our little tests, making them slow to access in a unit test situation, and also fragile and hard to run on, say, a train with no Wi-Fi.

The VCR[18] gem makes testing third-party services much easier. The gem monitors the interaction between your test and the rest of the world. If your test makes an HTTP request, VCR intercepts the responses and saves them as a “cassette,” which is just a YAML file with a particular structure. The next time you run the test, VCR intercepts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required