VCR and MiniTest: Automatic cassette management gem
Do you like how Rspec works with vcr? I do.
It is pretty awesome that you can pass :vcr to any spec that you want VCR to handle the requests for.
Now you can do this with MiniTest as well with https://github.com/mfpiccolo/minitest-vcr
MinitestVcr::Spec.configure! # Goes in test_helper.rb
describe Example::Spec do
describe 'an example group', vcr: true do
describe 'with a nested example group' do
before do
conn = Faraday.new
@response = conn.get 'http://example.com'
end
it 'uses a cassette for any examples' do
@response.wont_equal nil
end
end
end
end
Now VCR will automatically do something like this:
|-- app_name
| |-- test/
| |-- cassettes/
| |-- Example_Spec/
| |-- an_example_group/
| |-- with_a_nested_example_group/
| `-- uses_a_cassette_for_an_example_group.yml
| `-- example_test.rb
| `-- test_helper.rb
Written by Mike Piccolo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#