I am using Cucumber to test Braintree integration (for credit card payments) in a Rails 3.2 app. I am trying to add VCR gem to record the response from Braintree for the specs.
When i run the tagged scenario, it passes and records the cassette.
Problem:
When i rerun to check the use of the recorded cassette, it fails with this message -
not in gzip format (ActionView::Template::Error)
on a step immediately after loading the credit card (hosted) fields.
I tried playing around with the cassette option :decode_compressed_response
, but i am not sure i understand it right.
Any pointers in the right direction will be appreciated! :-)
Here's my VCR config (feature/config/vcr.rb
):
require 'vcr'
VCR.configure do |c|
c.cassette_library_dir = 'features/cassettes'
c.hook_into :webmock
c.default_cassette_options = {
:decode_compressed_response => false
}
c.ignore_localhost = true
end
VCR.cucumber_tags do |t|
t.tag '@vcr', :use_scenario_name => true
end
adding the following line to the c.default_cassette_options
gets rid of the not in gzip format
error.
:serialize_with => :compressed
This gzips the cassette after recording it in yaml format.
One thing that still puzzles me is why is VCR trying unzip a non-compressed cassette in the first place... haven't found a setting for that yet.