require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock c.default_cassette_options = { :record => :new_episodes } c.configure_rspec_metadata! end RSpec.configure do |c| c.treat_symbols_as_metadata_keys_with_true_values = true c.around(:each) do |example| options = example.metadata[:vcr] || {} if options[:record] == :skip VCR.turned_off(&example) else name = example.metadata[:full_description].gsub(/\s*$/, '').split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_") VCR.use_cassette(name, options, &example) end end end