Ruby Mocha: is there an equivalent to rspec-mocks' #and_call_original?

前端 未结 1 632
鱼传尺愫
鱼传尺愫 2020-12-11 00:41

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

相关标签:
1条回答
  • 2020-12-11 01:34

    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.
    
    0 讨论(0)
提交回复
热议问题