首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ruby Mocha:有没有等同于rspec-mocks的#and_call_original?

Ruby Mocha:有没有等同于rspec-mocks的#and_call_original?
EN

Stack Overflow用户
提问于 2014-02-12 07:10:47
回答 1查看 2K关注 0票数 20

Rspec-mocks有expect(some_object).to receive(:some_method).and_call_original。我能用Mocha做这件事吗?如果可以,怎么做?some_object.expects(:some_method).... ...what?

EN

回答 1

Stack Overflow用户

发布于 2014-03-29 14:29:20

我非常确定没有办法做到这一点。

浏览一下source code,有一条注释提到原来的方法被完全替换了。

代码语言:javascript
复制
# The original implementation of the method is replaced during the test and then restored at the end of the test. The temporary replacement method has the same visibility as the original method.
票数 13
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21715174

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档