O'Reilly logo

Rails 4 Test Prescriptions 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

Smoke Tests and VCR Options

So far we’ve used VCR to record an interaction once and preserve it for all time. VCR provides other options. These options are passed as key/value arguments to VCR.use_cassette(re_record_interval: 7.days) or, if you’re using RSpec metadata, as the value part of the metadata, as in vcr: {re_record_interval: 7.days}.

That re_record_interval that we just used as an example allows you to use the same VCR test as both an integration and a smoke test. The re_record_interval is an amount of time. If the requests on the associated cassette are older than the interval, then VCR will attempt to reconnect to the HTTP server and re-record the cassette. If the server is unavailable, VCR will just use the existing cassette.

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