pedestal

ccann 2019-03-08T19:11:43.020100Z

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…

ccann 2019-03-08T19:11:49.020300Z

anyone ever run into this? I’m doing this to test some of the interceptors that run before the handler

2019-03-08T19:13:08.020900Z

Hi @ccann! I suggest testing the interceptors directly instead

2019-03-08T19:13:26.021400Z

Use chain/execute

2019-03-08T19:13:34.021700Z

with an initial context

2019-03-08T19:14:37.022500Z

You can then inspect the context after

2019-03-08T19:14:46.022800Z

Rather, the resulting context

ccann 2019-03-08T19:15:49.023600Z

Thanks, I’ll take a look into that. is the issue with with-redefs known/intentional?

2019-03-08T19:17:09.024500Z

I’ve not tried that before. Offhand can’t think of why it doesn’t work

2019-03-08T19:17:25.024900Z

But it’s not the best way to test interceptors anyways

2019-03-08T19:17:42.025200Z

I tend to stay away from with-redefs in tests

2019-03-08T19:17:53.025500Z

for one thing it affects test parallelization

ccann 2019-03-08T20:10:44.026Z

yeah, i’m familiar with the tradeoffs of with-redefs, but it’s unbelievably convenient in this case haha