Skip to content

Instantly share code, notes, and snippets.

@juanmanuelramallo
Created May 14, 2019 19:22
Show Gist options
  • Save juanmanuelramallo/cc021ba1cfd6a8e1ae70ac467b77cb1e to your computer and use it in GitHub Desktop.
Save juanmanuelramallo/cc021ba1cfd6a8e1ae70ac467b77cb1e to your computer and use it in GitHub Desktop.
A simple helper to use vcr in tests
RSpec.configure do |c|
c.around(:each, :vcr) do |example|
name = example.metadata[:full_description].split(/\s+/, 2).join('/').underscore.gsub(%r{/[^\w\/]+/}, '_')
VCR.use_cassette(name) { example.call }
end
end
# Usage
# it 'should create a new credit card with given information', :vcr do
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment