From 64799454a2186596c70324db2958d0fc231d6f1b Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Mon, 25 Dec 2006 09:34:01 +0000 Subject: Fix assert_redirected_to bug where redirecting from a nested to to a top-level controller incorrectly added the current controller's nesting. Closes #6128. [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5785 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/assertions/response_assertions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller/assertions') diff --git a/actionpack/lib/action_controller/assertions/response_assertions.rb b/actionpack/lib/action_controller/assertions/response_assertions.rb index c0b78552f2..0811920e4a 100644 --- a/actionpack/lib/action_controller/assertions/response_assertions.rb +++ b/actionpack/lib/action_controller/assertions/response_assertions.rb @@ -70,14 +70,14 @@ module ActionController if value.respond_to?(:[]) && value['controller'] if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/') - value['controller'] = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) + new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) + value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path) end value['controller'] = value['controller'][1..-1] if value['controller'].first == '/' # strip leading hash end url[key] = value end - @response_diff = url[:expected].diff(url[:actual]) if url[:actual] msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is ), difference: ", url[:actual], @response_diff) -- cgit v1.2.3