Skip to content

Instantly share code, notes, and snippets.

@stengland
Created June 24, 2013 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stengland/5849379 to your computer and use it in GitHub Desktop.
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
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
@stengland
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment