I have some routes defined using table syntax and I wrote a test that uses response-for
wrapped with a with-redefs
that redefines the request handler. It doesn’t work, it still calls the original function. However, I can use with-redefs to redefine functions that are not the handler…
anyone ever run into this? I’m doing this to test some of the interceptors that run before the handler
Hi @ccann! I suggest testing the interceptors directly instead
Use chain/execute
with an initial context
http://pedestal.io/api/pedestal.interceptor/io.pedestal.interceptor.chain.html#execute
You can then inspect the context after
Rather, the resulting context
Thanks, I’ll take a look into that.
is the issue with with-redefs
known/intentional?
I’ve not tried that before. Offhand can’t think of why it doesn’t work
But it’s not the best way to test interceptors anyways
I tend to stay away from with-redefs
in tests
for one thing it affects test parallelization
yeah, i’m familiar with the tradeoffs of with-redefs, but it’s unbelievably convenient in this case haha