mimic
mimic copied to clipboard
Being able to call the original mocked function would be amazing.
There are many cases where I want to call the original function some number of times before then wanting to do something different, or perhaps wanting to call the original function conditionally dependent on the arguments.
I'm not aware of a current way of grabbing the original function. When I attempt this:
original = &MyModule.function/3
even if done before calling expect
, I get the mocked function.
(Hi, I just noticed this in passing, while checking up an issue I raised.)
It doesn't look particularly official but Mimic.Module.original/1
will give you access to the original module, and hence original functions.
Yeah it might be worth exposing a proper way to call the original 🤔