Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use RSpec tags to add behavior around specs.
# Add this to your spec_helper.rb
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].downcase.gsub(/\W+/, "_").split("_", 2).join("/")
VCR.use_cassette(name, :record => :new_episodes) do
it "fetches", :vcr do
# this will automatically use VCR to save the response

This comment has been minimized.

Copy link

@myronmarston myronmarston commented Sep 12, 2011

FWIW, config.around(:each, :vcr => true) do |example| can be simplified to config.around(:each, :vcr) do |example| since you've set the treat_symbols... option.


This comment has been minimized.

Copy link
Owner Author

@ryanb ryanb commented Oct 14, 2011

Thanks, fixed!


This comment has been minimized.

Copy link

@plexus plexus commented Dec 5, 2012

I ran into a problem where the filename became too long for my file system. See my fork for a fix.

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