I believe this is a missing feature/bug, but when I tried to file an
issue (https://github.com/rails/rails/issues/6573) I was told to post
it here instead. So, okay, doing my duty! I suspect that nobody will
pay any attention to this, and a year from now when someone google's
for this issue this post is going to be all they find, but I'd love to
be proven wrong!
I believe there is no way using the standard supported Rails testing
framework to test routes from an `isolated` engine. Or to test helpers
that use these routes.
I believe there is no way to test isolated engine helpers or use
isolated engine helpers in tests. But I'd be pleased if I'm wrong and
I'm just missing something.
If you create an isolated engine, then the dummy app has a config/
routes that has for instance mount Widget::Engine => "/widget"
If the Widget engines has it's own config/routes, then ordinarily an
app with that line in it would be able to access the engine's route
path helpers as widget.some_path.
That works in the app. But it does not work in the test environment.
No such method widget, the widget. method isn't installed in the test
The main engine root widget_path => /widget is installed in the
testing environment, you can use it in tests and test routing
involving that named helper and path. But not any of the specific
widget routes that would ordinarily, in an actual app, be available at
Phew, this is confusing to talk about, hope this is understandable.
I guess I'll keep hacking away at it and looking at Rails source,
maybe file a pull request if I can figure out what's going on, but
this is very convoluted code, even before you pull the testing
environment into it.