aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
diff options
context:
space:
mode:
authorschneems <richard.schneeman+foo@gmail.com>2018-10-03 16:15:47 -0500
committerschneems <richard.schneeman+foo@gmail.com>2018-10-03 16:15:47 -0500
commit235e734e1ea1e8bc1f8dcf2f6a75126a48fccd7a (patch)
treee2fe7a8f9f6c877b3cfbdf3452d8cb943260d5ad /actionpack/lib/action_dispatch/testing
parentebf98df9fb705738ece08e3182d41e6f604be491 (diff)
downloadrails-235e734e1ea1e8bc1f8dcf2f6a75126a48fccd7a.tar.gz
rails-235e734e1ea1e8bc1f8dcf2f6a75126a48fccd7a.tar.bz2
rails-235e734e1ea1e8bc1f8dcf2f6a75126a48fccd7a.zip
Revert "Merge pull request #33970 from rails/eager-url-helpers"
Until #34050 can be resolved This reverts commit 7f870a5ba2aa9177aa4a0e03a9d027928ba60e49, reversing changes made to 6556898884d636c59baae008e42783b8d3e16440.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb37
1 files changed, 10 insertions, 27 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 0e8712f8d9..af41521c5c 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -138,20 +138,6 @@ module ActionDispatch
assert_generates(path.is_a?(Hash) ? path[:path] : path, generate_options, defaults, extras, message)
end
- # Provides a hook on `finalize!` so we can mutate a controller after the
- # route set has been drawn.
- class WithRouting < ActionDispatch::Routing::RouteSet # :nodoc:
- def initialize(&block)
- super()
- @block = block
- end
-
- def finalize!
- super
- @block.call self
- end
- end
-
# A helper to make it easier to test different route configurations.
# This method temporarily replaces @routes with a new RouteSet instance.
#
@@ -166,19 +152,16 @@ module ActionDispatch
# end
#
def with_routing
- old_routes = @routes
- old_controller = nil
- @routes = WithRouting.new do |_routes|
- if defined?(@controller) && @controller
- old_controller, @controller = @controller, @controller.clone
- _routes = @routes
-
- @controller.singleton_class.include(_routes.url_helpers)
-
- if @controller.respond_to? :view_context_class
- @controller.view_context_class = Class.new(@controller.view_context_class) do
- include _routes.url_helpers
- end
+ old_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
+ if defined?(@controller) && @controller
+ old_controller, @controller = @controller, @controller.clone
+ _routes = @routes
+
+ @controller.singleton_class.include(_routes.url_helpers)
+
+ if @controller.respond_to? :view_context_class
+ @controller.view_context_class = Class.new(@controller.view_context_class) do
+ include _routes.url_helpers
end
end
end