Default Cassette Options
The default_cassette_options
configuration option takes a hash that provides defaults for each cassette you use. Any cassette can override the defaults as well as set additional options.
The :match_requests_on
option defaults to [:method, :uri]
when it has not been set.
The :record
option defaults to :once
when it has not been set.
Background ()
Given a file named "vcr_setup.rb" with:
cassettes get default values from configured default_cassette_options
default_cassette_options
Given a file named "default_cassette_options.rb" with:
When I run ruby default_cassette_options.rb
Then the output should contain:
:match_requests_on
defaults to [:method, :uri]
when it has not been set
:match_requests_on
defaults to [:method, :uri]
when it has not been setGiven a file named "default_cassette_options.rb" with:
When I run ruby default_cassette_options.rb
Then the output should contain "Match Requests On: [:method, :uri]".
:record
defaults to :once
when it has not been set
:record
defaults to :once
when it has not been setGiven a file named "default_record_mode.rb" with:
When I run ruby default_record_mode.rb
Then the output should contain "Record mode: :once".
:record_on_error
defaults to true
when it has not been set
:record_on_error
defaults to true
when it has not been setGiven a file named "default_record_on_error.rb" with:
When I run ruby default_record_on_error.rb
Then the output should contain "Record on error: true".
cassettes can set their own options
Given a file named "default_cassette_options.rb" with:
When I run ruby default_cassette_options.rb
Then the output should contain "Re-record Interval: 10000".
cassettes can override default options
Given a file named "default_cassette_options.rb" with:
When I run ruby default_cassette_options.rb
Then the output should contain:
Last updated