开发者

Testing Rails Metal With Cucumber/rSpec

开发者 https://www.devze.com 2022-12-23 20:17 出处:网络
I\'m trying to stub a third party service that my metal talks to. It seems rspec mocks/stubs don\'t extend all the way to the Metal.

I'm trying to stub a third party service that my metal talks to. It seems rspec mocks/stubs don't extend all the way to the Metal.

When I call stubbed methods on objects, it calls the original one and not the stubbed one.

Any idea of how I can have rSpec doubles extend all the way 开发者_JAVA百科to the metal?

Thanks.

-Nash


Have you considered using Fakeweb instead? This allows you to block all outgoing traffic and send a custom response instead. This way you don't even have to write a mock. It's very lightweight and easy to use.


You can also try using WebMock http://github.com/bblimke/webmock

0

精彩评论

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