From 8dc784292b67b842e437632a4ff883572ff97a3e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 24 Sep 2018 11:30:15 -0700 Subject: Eagerly build the routing helper module after routes are committed This commit eagerly builds the route helper module after the routes have been drawn and finalized. This allows us to cache the helper module but not have to worry about people accessing the module while route definition is "in-flight", and automatically deals with cache invalidation as the module is regenerated anytime someone redraws the routes. The restriction this commit introduces is that the url helper module can only be accessed *after* the routes are done being drawn. Refs #24554 and #32892 --- actionpack/test/controller/integration_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack/test/controller/integration_test.rb') diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 39ede1442a..b078e8ad9f 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -542,9 +542,6 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest def with_test_route_set with_routing do |set| controller = ::IntegrationProcessTest::IntegrationController.clone - controller.class_eval do - include set.url_helpers - end set.draw do get "moved" => redirect("/method") @@ -555,6 +552,10 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest end end + controller.class_eval do + include set.url_helpers + end + singleton_class.include(set.url_helpers) yield -- cgit v1.2.3