0

My VCR configure block is:

VCR.configure do |c|
  c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
  c.hook_into :webmock

  c.around_http_request(lambda { |req| req.uri =~ /google.com/ }) do |request|
    VCR.use_cassette(request.uri, :decode_compressed_response => true, &request)
  end
end

My tests work fine for post/get/put methods but when I try to DELETE, there is a clash in VCR because it matches with a previous PUT request. This is because the URI for that request is the same as the one needed for the DELETE request.

How do I change my use_cassette method so that it uses a combination of URI + method? (or any other suggestion also welcome!)

Thanks!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Christian-G
  • 2,371
  • 4
  • 27
  • 47

1 Answers1

0

Solved it, this might help others, so leaving it here:

VCR.use_cassette([request.uri,request.method].join.to_s, :match_requests_on => [:method, :uri], :decode_compressed_response => true, &request)

Christian-G
  • 2,371
  • 4
  • 27
  • 47