I found Cucumber and VCR's official documentation good, but over-complicated for what I wanted to do. Here are the steps it actually took me to get it working quickly and simply in my features (using fakeweb).
- Create the file 'features/support/vcr.rb' with the following contents:
- Inside the step definitions (in my steps files under 'features/steps/'):
require 'vcr'
VCR.config do |c|
c.stub_with :fakeweb
c.cassette_library_dir = 'features/cassettes'
end
VCR.use_cassette 'name' do
...
end
This will create the cassette file 'name' in the 'features/cassettes' directory. After recording your request/response the first time, any additional communications will be stopped by VCR, because the default options for VCR sets record to 'new episodes'.
No comments:
Post a Comment