Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VCR.configure do |config|
- config.cassette_library_dir = "test/fixtures/cassettes"
- config.hook_into :webmock
- config.default_cassette_options = {
- record: :once
- }
- config.before_record do |i|
- if i.response.headers["Content-Type"].any? { |h| h =~ /json/ }
- # Try to pretty format json body, rescue and proceed if it's not possible
- i.response.body.replace JSON.pretty_generate(JSON.parse(i.response.body)) rescue nil
- end
- i.response.body.force_encoding('UTF-8') # prevent recording as binary for readability
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement