Rspec-mocks has expect(some_object).to receive(:some_method).and_call_original
. Can I do this with Mocha, and if so, how? some_object.expects(:some_method)....
...what?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I'm fairly sure that there isn't a way to do this.
Looking through the source code, there's a comment that mentions that the original method is completely replaced.
# 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.