myronmarston/vcr — Issue #144: YAML parse error when reading cassettes
Author: olivernn
Created: 2012-03-05 12:07:09+00:00
State: open

I'm having some issues using VCR against an external API. I keep getting back a `Psych::SyntaxError ((): couldn't parse YAML at line 0 column 607)` when trying to replay saved interactions.

I was having this issue when using YAML cassettes, so switched to JSON serialization, but am still getting the same error. For what its worth, I can parse the JSON in the cassette manually without any problems.

The only thing I can think of is that somehow it is still trying to use the YAML serializer with a json cassette. My code looks like this:

VCR.use_cassette(path_to_cassette, serialize_with: :json) do
response = HxApi.get(request.path_info, query: request.params)
[
response.code,
response.headers.to_hash.slice('content-type', 'content-length'),
[response.body]
]
end

And the setup code looks like this

VCR.configure do |c|
c.default_cassette_options = { serialize_with: :json }
c.cassette_library_dir = 'spec/vcr_cassettes'
c.hook_into :webmock
c.ignore_hosts '127.0.0.1' # allow selenium/capybara to do its thing
end