include_http_adapter_for("<http_lib>")
require 'vcr'
VCR.configure do |c|
<configuration>
c.cassette_library_dir = 'cassettes'
end
VCR.use_cassette('example', :match_requests_on => [:body_as_json]) do
puts "Response for body as json 2: " + response_body_for(:put, "http://example.com/", '{ "a" : "1", "b" : "2" }')
end
VCR.use_cassette('example', :match_requests_on => [:body_as_json]) do
puts "Response for body as json 1: " + response_body_for(:put, "http://example.com/", '{ "a" : "1" }')
end
When I run ruby body_as_json_matching.rb
Then it should pass with:
Response for body as json 2: body2 response
Response for body as json 1: body1 response