Skip to content

Instantly share code, notes, and snippets.

@johndel
Created February 4, 2013 13:53
Show Gist options
  • Save johndel/4706858 to your computer and use it in GitHub Desktop.
Save johndel/4706858 to your computer and use it in GitHub Desktop.
vcr
VCR.configure do |c|
c.ignore_localhost = true
c.cassette_library_dir = Rails.root.join("spec", "vcr")
c.hook_into :webmock
end
RSpec.configure do |c|
c.treat_symbols_as_metadata_keys_with_true_values = true
c.around(:each, :vcr) do |example|
name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
options = example.metadata.slice(:record, :match_requests_on).except(:example_group)
VCR.use_cassette(name, options) { example.call }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment