diff options
author | Jamis Buck <jamis@37signals.com> | 2006-08-01 21:34:58 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-08-01 21:34:58 +0000 |
commit | 49f44daf174ab18e00d16e9df1b153b660483261 (patch) | |
tree | bdcd0c5aa9d765f02bb32278f84f5886aa77c530 /actionpack/lib/action_controller | |
parent | 0cfde5f8c063c74e9ad49c2c9eae96256155c3bd (diff) | |
download | rails-49f44daf174ab18e00d16e9df1b153b660483261.tar.gz rails-49f44daf174ab18e00d16e9df1b153b660483261.tar.bz2 rails-49f44daf174ab18e00d16e9df1b153b660483261.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/assertions.rb | 10 |
1 files changed, 8 insertions, 2 deletions
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) |