inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertia-rails.dev/
MIT License
574 stars 45 forks source link

Misleading "Inertia test helpers aren't set up!" warning #61

Closed christoomey closed 3 years ago

christoomey commented 3 years ago

I've been using the spec helper and I've run into an issue where I'm seeing "Inertia test helpers aren't set up!", despite the fact that they are indeed set up. In my case I ran into this when a before_action that I was not expecting to run did end up running, and thus I never got to the render(inertia ... call.

This seems to be due to the fact that the stubbing of render method is done lazily when the render(inertia ... is actually called.

Presuming these spec helpers are intended for use in applications and not just for the library itself (which I really hope is the intention as they're great!), I think it would be great to look into fixing this as it can lead to a confusing experience. I'd be happy to poke around and see if I could resolve this and open a PR if I could, but wanted to start with an issue to see if there are any existing thoughts or constraints I'm unaware of.

Thanks again for the great library!

bknoles commented 3 years ago

hey @christoomey thanks for calling this out! it has tripped me up in the past as well. @BrandonShar and I talked about it sometime last year and then promptly forgot about it 😂

I think #62 should take care of it. take a look and let me know if you have any comments on the PR!