Closed HCanber closed 9 years ago
This PR adds stub.callOriginal() that configures a stub to call the original unstubbed function.
stub.callOriginal()
Can be useful for example if you want the stubbed function to throw an error the first time it's called and succeed the second time.
simple.mock(obj, 'example').throwWith(new Error()).callOriginal()
I also added callOriginalFn as an alias for callOriginal(to be similar to callFn that ends in Fn)
callOriginalFn
callOriginal
callFn
Fn
Unsure about the name "callOriginal". Maybe you have a better suggestion.
That's really nice. I think the name is fine and the code looks good to me. Thanks.
This PR adds
stub.callOriginal()
that configures a stub to call the original unstubbed function.Can be useful for example if you want the stubbed function to throw an error the first time it's called and succeed the second time.
I also added
callOriginalFn
as an alias forcallOriginal
(to be similar tocallFn
that ends inFn
)Discussion
Unsure about the name "
callOriginal
". Maybe you have a better suggestion.