Rspec-mocks 具有expect(some_object).to receive(:some_method).and_call_original
。我可以用 Mocha 做这个吗?如果可以,怎么做? some_object.expects(:some_method)....
...什么?
最佳答案
我相当确定没有办法做到这一点。
浏览source code , 有评论提到完全替换了原来的方法。
# 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.
关于 ruby 摩卡 : is there an equivalent to rspec-mocks' #and_call_original?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21715174/