Skip to content

Instantly share code, notes, and snippets.

@kincorvia
Created January 15, 2013 17:54
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save kincorvia/4540489 to your computer and use it in GitHub Desktop.
Save kincorvia/4540489 to your computer and use it in GitHub Desktop.
VCR Depecrations
# Typically in Rails to use VCR we setup the RSpec config like so:
RSpec.configure do |config|
config.extend VCR::RSpec::Macros #deprecated
end
# This gives us access to the use_vcr_cassette method:
describe Reviewed::Article do
use_vcr_cassette 'article/grill'
end
# This now will issue deprecation warnings. The preferred method now is
# to use rspec metadata options. Do not put above lines in your RSpec config.
# Instead in your VCR config add:
VCR.configure do |config|
config.configure_rspec_metadata!
end
# In order to use VCR for a spec group you now have two options:
describe Reviewed::Article, vcr: true do
end
# This will automatically create fixture folders and files in your configured
# location using spec group block names as appropriate.
# The second option is to pass options to vcr:
vcr_options: { cassette_name: 'article/grill' }
describe Reviewed::Article, vcr: vcr_options do
end
# This will allow you to override any vcr option like setting the casette name.
@nicolasiensen
Copy link

The automatically generated folders for cassettes yml files are awesome!

@sailing
Copy link

sailing commented Aug 23, 2016

@bswinnerton, thanks for that comment. saved me a headache :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment