Created
June 24, 2013 11:26
-
-
Save stengland/5849379 to your computer and use it in GitHub Desktop.
Match VCR request body as xml doc rather than string. Will account for different versions of LibXML outputting slightly different XML (mainly empty tags) even though the xml document is equivalent. Uses http://rubygems.org/gems/equivalent-xml
This file contains 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 |c| | |
c.register_request_matcher :xml_body do |request_1, request_2| | |
EquivalentXml.equivalent?(request_1.body, request_2.body) | |
end | |
c.ignore_localhost = true | |
c.cassette_library_dir = Rails.root.join("spec", "support", "vcr_cassettes") | |
c.hook_into :webmock | |
c.configure_rspec_metadata! | |
c.default_cassette_options = { match_requests_on: [:method, :uri, :xml_body] } | |
# c.debug_logger = File.open("#{Rails.root}/log/vcr.log", 'w') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Article about custom matcher in VCR http://myronmars.to/n/dev-blog/2011/10/custom-request-matchers-in-vcr-2-0