Created
August 28, 2015 21:22
-
-
Save jtrim/2501f587537d37eede26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment