开发者

Faking web requests in Rails test without Fakeweb

I'm using the Handsoap gem with Httpclient gem as the driver in a Rails app.

How can 开发者_高级运维I prevent network calls from Handsaop/Httpclient gems in test cases?

FakeWeb doesn't support Httpclient.


You can use WebMock http://github.com/bblimke/webmock. It has support for Httpclient.


You can use the mock driver for Handsoap (Handsoap::Http::Drivers::MockDriver). See in the tests for an example.


That's right, FakeWeb currently only supports libraries based on Net::HTTP.

Here's a ticket about adding HttpClient support, which also references a couple older forks that attempt to do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜