aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/test_process.rb25
1 files changed, 12 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 60c8e1a02c..5248cd1e90 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -66,11 +66,10 @@ module ActionController #:nodoc:
def path
@path || super()
end
-
- def generate_route_and_assign_parameters(controller_path, action, parameters)
- parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action)
- path, extras = ActionController::Routing::Routes.generate(parameters)
- non_path_parameters = get? ? query_parameters : request_parameters
+
+ def assign_parameters(parameters)
+ path, extras = ActionController::Routing::Routes.generate(parameters.symbolize_keys)
+ non_path_parameters = (get? ? query_parameters : request_parameters)
parameters.each do |key, value|
(extras.key?(key.to_sym) ? non_path_parameters : path_parameters)[key] = value
end
@@ -249,7 +248,9 @@ module Test
@request.action = action.to_s
parameters ||= {}
- @request.generate_route_and_assign_parameters(@controller.class.controller_path, action.to_s, parameters)
+ parameters[:controller] = @controller.class.controller_path
+ parameters[:action] = action.to_s
+ @request.assign_parameters(parameters)
@request.session = ActionController::TestSession.new(session) unless session.nil?
@request.session["flash"] = ActionController::Flash::FlashHash.new.update(flash) if flash
@@ -306,13 +307,11 @@ module Test
end
def build_request_uri(action, parameters)
- unless @request.env['REQUEST_URI']
- options = @controller.send(:rewrite_options, parameters)
- options.update(:only_path => true, :action => action)
-
- url = ActionController::UrlRewriter.new(@request, parameters)
- @request.set_REQUEST_URI(url.rewrite(options))
- end
+ return if @request.env['REQUEST_URI']
+ url = ActionController::UrlRewriter.new(@request, parameters)
+ @request.set_REQUEST_URI(
+ url.rewrite(@controller.send(:rewrite_options,
+ (parameters||{}).update(:only_path => true, :action=>action))))
end
def html_document