Many of my test files includes snippets like this:
import Mox
setup :verify_on_exit!
However, if I’m only importing mox so that I can directly call verify_on_exit!
that feels like a hinderance to readability.
In my mind it would be nice if this worked:
setup &Mox.verify_on_exit!/1
But this results in the error: (ArgumentError) setup/setup_all expect a callback name as an atom or a list of callback names
.
A working alternatives is:
setup :verify_on_exit!
defdelegate verify_on_exit!(context), to: Mox
Is there any better way than that?