You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Last week deferred route drawing was merged into Rails master to improve boot times for larger apps with lots of routes. Routes are now lazy loaded for Rails environments that have config.eager_load disabled, which is the case by default for the development and test environments.
Basically by default for the test environment, whenever a route is visited, routes get lazy loaded. Devise's mappings aren't loaded when the test starts, they are only loaded when the test visits a route, because Devise's entry point is defined in the route files with devise_for or devise_scope.
But in integration and controller tests you typically call the sign_in helper before visiting the route. At this point Devise mappings and scopes aren't loaded yet, so Devise will error out.
Environment
Current behavior
When using the
sign_in
Devise test helper method in a controller or integration test, I get the following error:Here is a minimal reproduction of the issue (run this with
ruby repro.rb
):Expected behavior
Tests should pass:
Additional information
Last week deferred route drawing was merged into Rails master to improve boot times for larger apps with lots of routes. Routes are now lazy loaded for Rails environments that have
config.eager_load
disabled, which is the case by default for the development and test environments.Basically by default for the test environment, whenever a route is visited, routes get lazy loaded. Devise's mappings aren't loaded when the test starts, they are only loaded when the test visits a route, because Devise's entry point is defined in the route files with
devise_for
ordevise_scope
.But in integration and controller tests you typically call the
sign_in
helper before visiting the route. At this point Devise mappings and scopes aren't loaded yet, so Devise will error out.cc @gmcgibbon
Potential fix: #5695
The text was updated successfully, but these errors were encountered: