用 Cucumber/rSpec 测试金属导轨

发布于 2024-08-25 17:27:22 字数 153 浏览 4 评论 0原文

我正在尝试存根与我的金属通信的第三方服务。看来 rspec 模拟/存根并没有一直延伸到 Metal。

当我对对象调用存根方法时,它会调用原始方法,而不是存根方法。

知道如何让 rSpec 双打一直延伸到金属吗?

谢谢。

-纳什

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 to the metal?

Thanks.

-Nash

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍风燃霜 2024-09-01 17:27:22

您是否考虑过使用 Fakeweb 来代替?这允许您阻止所有传出流量并发送自定义响应。这样你甚至不必编写模拟。它非常轻巧且易于使用。

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.

猫七 2024-09-01 17:27:22

您还可以尝试使用 WebMock http://github.com/bblimke/webmock

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文