Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. VCR.configure do |config|
  2. config.cassette_library_dir = "test/fixtures/cassettes"
  3. config.hook_into :webmock
  4. config.default_cassette_options = {
  5. record: :once
  6. }
  7. config.before_record do |i|
  8. if i.response.headers["Content-Type"].any? { |h| h =~ /json/ }
  9. # Try to pretty format json body, rescue and proceed if it's not possible
  10. i.response.body.replace JSON.pretty_generate(JSON.parse(i.response.body)) rescue nil
  11. end
  12. i.response.body.force_encoding('UTF-8') # prevent recording as binary for readability
  13. end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement