aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/routing.rb4
-rw-r--r--actionpack/lib/action_controller/test_process.rb10
2 files changed, 9 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index 5499cd2545..f2e7df6d6d 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -554,6 +554,10 @@ module ActionController
NamedRoutes.name_route(route, name)
route
end
+
+ def extra_keys(options, recall = {})
+ generate(options.dup, recall).last.keys
+ end
end
module NamedRoutes
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index d54af674cc..1092a860c9 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -67,12 +67,12 @@ module ActionController #:nodoc:
@path || super()
end
- def generate_route_and_assign_parameters(controller_path, action, parameters)
+ def assign_parameters(controller_path, action, parameters)
parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action)
- path, extras = ActionController::Routing::Routes.generate(parameters.dup)
+ extra_keys = ActionController::Routing::Routes.extra_keys(parameters)
non_path_parameters = get? ? query_parameters : request_parameters
parameters.each do |key, value|
- if extras.key?(key.to_sym) then non_path_parameters[key] = value
+ if extra_keys.include?(key.to_sym) then non_path_parameters[key] = value
else path_parameters[key] = value.to_s
end
end
@@ -251,7 +251,7 @@ module Test
@request.action = action.to_s
parameters ||= {}
- @request.generate_route_and_assign_parameters(@controller.class.controller_path, action.to_s, parameters)
+ @request.assign_parameters(@controller.class.controller_path, action.to_s, parameters)
@request.session = ActionController::TestSession.new(session) unless session.nil?
@request.session["flash"] = ActionController::Flash::FlashHash.new.update(flash) if flash
@@ -344,4 +344,4 @@ module Test
end
end
end
-end \ No newline at end of file
+end