parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
720 stars 131 forks source link

ExVCR is trying to match request even though i'm not using use_cassete #136

Open sescobb27 opened 6 years ago

sescobb27 commented 6 years ago

Hi there, i'm trying to do some integration testing hitting a real 3rd party service (Stripe) and not a cassette, so i'm not using use_cassette or anything like that but still getting a RequestNotMatchError with a "previous" cassette (oembed-youtube). is there a way to disable ExVCR or to let it know i'm not asking to record a new cassette? (it works if i just run mix test PATH/TO/TEST.exs) but not when running mix test

** (ExVCR.RequestNotMatchError) Request did not match with any one in the current cassette: test/fixtures/vcr_cassettes/oembed-youtube.json.
     Delete the current cassette with [mix vcr.delete] and re-record.
dwhelan commented 6 years ago

I ran into a similar problem and found that if I configured ExVCR to "clear mocks" then the mocking behaviour would be cleared between tests.

use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney, clear_mock: true
sescobb27 commented 6 years ago

@dwhelan oh, thanks, i will try that.

sescobb27 commented 6 years ago

unfortunately, that didn't work 😞 i'm still getting (ExVCR.RequestNotMatchError) from previous cassette

** (ExVCR.RequestNotMatchError) Request did not match with any one in the current cassette: test/fixtures/vcr_cassettes/oembed-youtube.json.
     Delete the current cassette with [mix vcr.delete] and re-record.
SkipMike commented 5 years ago

This didn't work for me either. For reference, I've got an umbrella application, but all my errors seem to be happening within the same umbrella application.

SkipMike commented 5 years ago

I'm also using exvcr 0.10.0.

SkipMike commented 5 years ago

I've updated to 0.10.3 and still seeing the same problems.

a-kinder commented 5 years ago

I'm experiencing the same issue after adding SendGrid to tests that do not use ExVCR. When running a single test file by itself the problem does not occur. Adding clear_mock did not work.

a-kinder commented 5 years ago

For posterity: syntax should be options: [clear_mock: true]. This worked for me