1

I am wondering if there is an out-of-the-box solution for ignoring certain body properties when matching requests on :body?

When I record VCR data, I am utilizing one endpoint to handle two requests with similar data. If I match on the default :method method, then it plays back the first recording for both requests so I am forced to match on body, as I am sending the request data via the body and not the params in the uri. If I was doing it that way, it would be an easy solution: use VCR.request_matcher.uri_without_params(:id), however I am in need of either an ootb solution or a custom matcher. I should point out that I am not very familiar with rails and am very very new to it in this job.

Now, once I have my tests reading those data they are making new request with another id and are not returning any data as it is still trying to match the body to the body I am sending which requires an id.

I really hope I am making sense.

Thanks,

taras
  • 6,566
  • 10
  • 39
  • 50
  • 2
    I think you have to register a custom matcher that ignore the body fields that you don't want to match. Did you see this article in its wiki? https://github.com/vcr/vcr/wiki/Common-Custom-Matchers I hope this can help you. – Américo Duarte Jan 09 '19 at 09:52
  • Thank you. First time I am seeing this article. – Daniel Lopez Jan 09 '19 at 19:52

0 Answers0