3

I'm currently using RSpec2, Cucumber and VCR (via WebMock), and everything's working great.

With VCR normally all requests are recorded and then replayed against the recorded cassettes.

Now I want to allow real web requests in some scenarios:

  • In Cucumber, I've setup a "live" profile which runs any test tagged with @live. For these tests – and these tests only – I'd like to allow real web requests.
  • I want from time to time run the tests against the real api and ignore the recordings
Heiko Rupp
  • 30,426
  • 13
  • 82
  • 119
Cory Schires
  • 2,146
  • 2
  • 14
  • 26

1 Answers1

12

You can do this with cucumber's Before and After hooks. Just disable VCR using something like this:

Before('@live') do
  VCR.eject_cassette
  VCR.turn_off!
end

This may be dependent on exactly how you are integrating VCR with your cucumber tests though.

AlistairH
  • 3,139
  • 2
  • 21
  • 19