Reputation: 7586
It appears as though setting any method-call expectation with Mocha prevent the original implementation from being called.
This seems to cover calling the original method with rspec.
Is there a way to do this with Mocha? Or does anyone know why this wouldn't be supported?
Upvotes: 13
Views: 4002
Reputation: 1920
This is not possible for a couple reasons. One reason is that testing the side effect of a method and testing the invocation of a method can be done more clearly in two separate tests. Another reason I've read is that in purist unit testing, you wouldn't make an assertion about another method's side effect. You would test the invocation and then test the called methods side effects in unit tests for that specific method.
Upvotes: -8