minitest-vcr
Project | Gem Release |
---|---|
Gem name | minitest-vcr |
License | MIT |
Version | |
Continuous Integration | |
Test Coverage | |
Grade | |
Homepage | http://mfpiccolo.github.io/minitest-vcr |
Documentation | http://rdoc.info/github/mfpiccolo/minitest-vcr/frames |
Issues | https://github.com/mfpiccolo/minitest-vcr/issues |
Description
Allows VCR to automatically make cassetes with proper file paths using Minitest.
Features
Examples
Two main steps:
- Install and require the gem
- Add
MinitestVcr::Spec.configure!
before your tests load
The setup below will create a direcotry structre that looks 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
An example test_helper file: app_name/test/test_helper.rb
require "minitest/autorun"
require "minispec-metadata"
require "vcr"
require "minitest-vcr"
require "webmock"
require "mocha/setup"
require "faraday"
VCR.configure do |c|
c.cassette_library_dir = 'test/cassettes'
c.hook_into :webmock
end
MinitestVcr::Spec.configure!
An example test file: app_name/test/example_test.rb
require "test_helper"
describe Example::Spec do
# Notice here symbols are treated as true values
# You could also do vcr: true
describe 'an example group', :vcr 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
Requirements
Installation
Add this line to your application's Gemfile:
gem "minitest-vcr"
And then execute:
$ bundle
Or install it yourself as:
$ gem install minitest-vcr
Donating
Support this project and others by mfpiccolo via gittip.
Copyright
Copyright (c) 2013 Mike Piccolo
See LICENSE.txt for details.
Contributing
- Fork it ( http://github.com//minitest-vcr/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request