1

I would like to fake a network timeout in my cucumber step definition like so:

Given(/^the network is timing out$/) do
  stub_request(:any, 'www.example.com').to_raise(RestClient::GatewayTimeout)
end

It will give the error that stub_request does not exist.

So, my question is where to find the webmock object within VCS, so i can add a stub_request.

orde
  • 5,233
  • 6
  • 31
  • 33
Mischa Molhoek
  • 164
  • 1
  • 9

2 Answers2

0

in env.rb:

require 'webmock/cucumber'
Jason
  • 861
  • 9
  • 17
0

i ended up making a little library that makes it very easy to test arbitrary errors when accessing/testing url's in cucumber

https://github.com/mmolhoek/vcr-uri-catcher

grtz

Mischa Molhoek
  • 164
  • 1
  • 9