VCR and RSpec

Learn about different VCR options and how to use them with RSpec.

VCR and RSpec

We can use RSpec metadata to specify that any RSpec it or describe block uses a VCR cassette. The configuration goes into another RSpec support file:

Press + to interact
VCR.configure do |c|
c.cassette_library_dir = "spec/cassettes"
c.hook_into :webmock
c.configure_rspec_metadata!
c.ignore_localhost = true
end

VCR options

Here, four options are specified:

First option

First, the directory where VCR is going to place its cassette files (which can be anything we want, but something like spec/cassettes ...