From 49f44daf174ab18e00d16e9df1b153b660483261 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 1 Aug 2006 21:34:58 +0000 Subject: More tweaks to make sure assert_redirected_to works with symbols git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4649 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/assertions.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index 710daa3a4d..e81ebfb893 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -81,8 +81,9 @@ module Test #:nodoc: original = { :expected => options, :actual => @response.redirected_to.is_a?(Symbol) ? @response.redirected_to : @response.redirected_to.dup } original.each do |key, value| if value.is_a?(Symbol) - value = @controller.respond_to?(value, true) ? @controller.send(value) : @controller.send("hash_for_#{option}") + value = @controller.respond_to?(value, true) ? @controller.send(value) : @controller.send("hash_for_#{value}_url") end + unless value.is_a?(Hash) request = case value when NilClass then nil @@ -91,8 +92,13 @@ module Test #:nodoc: end value = request.path_parameters if request end - + if value.is_a?(Hash) # stringify 2 levels of hash keys + if name = value.delete(:use_route) + route = ActionController::Routing::Routes.named_routes[name] + value.update(route.parameter_shell) + end + value.stringify_keys! value.values.select { |v| v.is_a?(Hash) }.collect { |v| v.stringify_keys! } if key == :expected && value['controller'] == @controller.controller_name && original[:actual].is_a?(Hash) -- cgit v1.2.3