diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-06-29 02:41:00 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-06-29 02:41:00 +0000 |
commit | 31e48939b13b5960eec0167ef0b71cd65ed36ed4 (patch) | |
tree | 077731411abd5d6174db298f52b9c37e222edd90 /actionpack/lib/action_controller/test_process.rb | |
parent | 453ed1539500f3dc9f704bb0933f50cc42bbe46a (diff) | |
download | rails-31e48939b13b5960eec0167ef0b71cd65ed36ed4.tar.gz rails-31e48939b13b5960eec0167ef0b71cd65ed36ed4.tar.bz2 rails-31e48939b13b5960eec0167ef0b71cd65ed36ed4.zip |
r1475@iwill: jeremy | 2005-06-28 23:19:51 -0700
Ticket 1543 - Fix test_process
r1476@iwill: jeremy | 2005-06-29 00:20:53 -0700
Correct expected, actual order for assert_equal. Use new render method in TestController.
r1477@iwill: jeremy | 2005-06-29 00:23:45 -0700
Generate route and assign parameters without modifying the user's params.
r1480@iwill: jeremy | 2005-06-29 00:28:52 -0700
Update changelog.
r1481@iwill: jeremy | 2005-06-29 00:34:02 -0700
Directly generate paths with a leading slash instead of tacking it on later.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1557 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 5248cd1e90..60c8e1a02c 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -66,10 +66,11 @@ module ActionController #:nodoc: def path @path || super() end - - def assign_parameters(parameters) - path, extras = ActionController::Routing::Routes.generate(parameters.symbolize_keys) - non_path_parameters = (get? ? query_parameters : request_parameters) + + 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 parameters.each do |key, value| (extras.key?(key.to_sym) ? non_path_parameters : path_parameters)[key] = value end @@ -248,9 +249,7 @@ module Test @request.action = action.to_s parameters ||= {} - parameters[:controller] = @controller.class.controller_path - parameters[:action] = action.to_s - @request.assign_parameters(parameters) + @request.generate_route_and_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 @@ -307,11 +306,13 @@ module Test end def build_request_uri(action, parameters) - 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)))) + 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 end def html_document |