gpt4 book ai didi

ruby 摩卡 : is there an equivalent to rspec-mocks' #and_call_original?

转载 作者:行者123 更新时间:2023-12-01 08:06:21 24 4
gpt4 key购买 nike

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/48951353/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com