From 930b59eb39e2078ae83159d72dee9389ecc04897 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Jun 2005 14:36:13 +0000 Subject: Fixed that Functional tests do not set request.path_parameters properly #1512 [Nicholas Seckar] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1527 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/test_process.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 93d9dd8a2f..5248cd1e90 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -67,6 +67,13 @@ module ActionController #:nodoc: @path || super() end + 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 + end private def initialize_containers @@ -239,9 +246,12 @@ module Test @html_document = nil @request.env['REQUEST_METHOD'] ||= "GET" @request.action = action.to_s - @request.path_parameters = { :controller => @controller.class.controller_path, - :action => action.to_s } - @request.parameters.update(parameters) unless parameters.nil? + + 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 build_request_uri(action, parameters) -- cgit v1.2.3