parroty / exvcr

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

Bypass recorded responses #81

Open gmile opened 7 years ago

gmile commented 7 years ago

We like VCR, and would like to use it in our test suite. We have a suite, that is full of use_cassette calls

Most of the time we are happy with out test suite hitting recorded response. However, right before deploy, we'd like our requests to hit a live remote service. Unfortunately, it means that we need to remove a folder with all cassettes every time we actually need to hit external service.

What we'd like to have is a configurable ability to bypass cassettes.

Options to implement this include:

  1. make use_cassette include a flag, say skip: true, to skip or not skip the cassette. We then could make something like:

      use_cassette "path/to/my_cassette", skip: System.get_env(:RUN_LIVE_REQUESTS) do
      # ...
      end
  2. same as in item 1, only make this configurable at a higher level, e.g. in config :exvcr, skip_cassettes: true,

  3. have implemented both items 1 and 2, with setting for 1 overriding setting from 2.

gmile commented 7 years ago

@parroty if this is something you are open to include in exvcr, I'd like to take a stab at it