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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access