Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable webmock for a Capybara tests?

I'm using webmock and VCR for some of my basic Rspec tests, but I want to disable webmock for my acceptance tests so that I can actually make external HTTP requests.

What's the best way to do this?

like image 565
Jackson Cunningham Avatar asked Sep 15 '15 17:09

Jackson Cunningham


Video Answer


2 Answers

you can just do

before do
  VCR.turn_off!
  WebMock.allow_net_connect!
end

after do
  VCR.turn_on!
  WebMock.disable_net_connect!
end
like image 73
patrick Avatar answered Oct 12 '22 23:10

patrick


From the README:

WebMock.allow_net_connect!
like image 43
Josh Avatar answered Oct 12 '22 23:10

Josh