Super Fast VCR Configuration for RSpec and MiniTest
Ruby on Rails, Technology
You determined to use VCR by reading following from the README:
Record your test suite’s HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
But the README of VCR gem has a little clutter and the configuration mentioned there shows few deprecation warning when we run the spec.
Here is a configuration which will work best for most of the cases with RSpec (and also with minitest).
Configure following gems in Gemfile and bundle
Create following file as mentioned in the comment below
Modify rails_helper.rb/spec_helper.rb to add following line at the top
require 'support / vcr_setup'
You can now use it in your spec. I strongly recommend to Ryan Bates Video to get to know how VCR works.
At BoTree Technologies, we build enterprise applications with our RoR team of 25+ engineers.
Consulting is free – let us help you grow!
Amit is the COO and Co-founder of BoTree Technologies. He is a developer advocate and solution architect at the company. He has helped many SME and Large corporations digitize their business operations. He loves hanging out with friends and meditate.
Choose Your Language
Subscribe to Our Newsletter
- Digital Marketing
- IT Consulting
- Project Management