20

Rspec 模拟具有expect(some_object).to receive(:some_method).and_call_original. 我可以用摩卡做这个吗?如果可以,怎么做?some_object.expects(:some_method).......什么?

4

1 回答 1

13

我相当确定没有办法做到这一点。

翻看源码,有评论说原方法完全被替换了。

# 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.
于 2014-03-29T06:29:20.397 回答