Monday, 15 March 2010

ruby on rails - Webmock not catching external API calls -


I should be duplicate an external API request as part of a new coccyge test. My usual practice is to write the first test that calls, and webmail expects to complain about it. The request can then be attributed, using information provided by WebMock.

But in this repo (which is new to me), webmail does not stop requesting. It's just time out Even more curious, it behaves properly as I tell in the RSPC (this stops the effort of my request, and tells me how to fake it), but not in cucumber.

I have this in features

  WebMock.disable_net_connect! (: Allow_localhost = & gt; true)  

I also imposed a single line in features \ support \ env.rb . Still permits the request

I have to find out how to stop it another way, but it bothers me that if I make a mistake, my test could make a live call. Can anyone help?

Update:

I have determined that (: allow_localhost => is true) actually maintaining external requests, but it is WebMock Does not trigger a mechanism that shows bad requests (I believe by defending an exception), and instead the request is only out of time, still do not know why.

2 Update:

I have found the problem This repo uses a custom customer gem to talk to any other internal service; it saves gem connection errors, and Thus the webmail error is swallowed.


No comments:

Post a Comment