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 => [:headers]) do
puts "Response for user 2: " + response_body_for(:get, "http://example.com/", nil, 'X-User-Id' => '2')
end
VCR.use_cassette('example', :match_requests_on => [:headers]) do
puts "Response for user 1: " + response_body_for(:get, "http://example.com/", nil, 'X-User-Id' => '1')
end
When I run ruby header_matching.rb
Then it should pass with:
Response for user 2: user 2 response
Response for user 1: user 1 response