Smoke Tests and VCR Options

So far you’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 I 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.

This allows ...

Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.