Record modes dictate under what circumstances http requests/responses are recorded to cassettes (disk). Set the recording mode with the parameter record
in the use_cassette()
and insert_cassette()
functions.
The once
record mode will:
It is similar to the new_episodes
record mode, but will prevent new, unexpected requests from being made (i.e. because the request URI changed or whatever).
once
is the default record mode, used when you do not set one.
The none
record mode will:
This is useful when your code makes potentially dangerous HTTP requests. The none
record mode guarantees that no new HTTP requests will be made.
The new_episodes
record mode will:
It is similar to the once
record mode, but will always record new interactions, even if you have an existing recorded one that is similar (but not identical, based on the match_request_on
option).
The all
record mode will:
This can be temporarily used to force vcr to re-record a cassette (i.e. to ensure the responses are not out of date) or can be used when you simply want to log all HTTP requests.
Check out the http testing book for a lot more documentation on vcr
, webmockr
, and crul