<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -97,7 +97,7 @@ module ActionController
                 value['controller'] = value['controller'].to_s
                 if key == :actual &amp;&amp; value['controller'].first != '/' &amp;&amp; !value['controller'].include?('/')
                   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 &amp;&amp; ActionController::Routing.possible_controllers.include?(new_controller_path)
+                  value['controller'] = new_controller_path if value['controller'] != new_controller_path &amp;&amp; ActionController::Routing.possible_controllers.include?(new_controller_path) &amp;&amp; @response.redirected_to.is_a?(Hash)
                 end
                 value['controller'] = value['controller'][1..-1] if value['controller'].first == '/' # strip leading hash
               end</diff>
      <filename>actionpack/lib/action_controller/assertions/response_assertions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -137,6 +137,9 @@ class AssertResponseWithUnexpectedErrorController &lt; ActionController::Base
   end
 end
 
+class UserController &lt; ActionController::Base
+end
+
 module Admin
   class InnerModuleController &lt; ActionController::Base
     def index
@@ -174,7 +177,7 @@ class ActionPackAssertionsControllerTest &lt; Test::Unit::TestCase
   # let's get this party started
   def setup
     ActionController::Routing::Routes.reload
-    ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module content admin/user))
+    ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module user content admin/user))
     @controller = ActionPackAssertionsController.new
     @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
   end
@@ -268,7 +271,7 @@ class ActionPackAssertionsControllerTest &lt; Test::Unit::TestCase
       assert_redirected_to admin_inner_module_path
     end
   end
-  
+
   def test_assert_redirected_to_top_level_named_route_from_nested_controller
     with_routing do |set|
       set.draw do |map|
@@ -277,11 +280,25 @@ class ActionPackAssertionsControllerTest &lt; Test::Unit::TestCase
       end
       @controller = Admin::InnerModuleController.new
       process :redirect_to_top_level_named_route
-      # passes -&gt; assert_redirected_to &quot;http://test.host/action_pack_assertions/foo&quot;
+      # assert_redirected_to &quot;http://test.host/action_pack_assertions/foo&quot; would pass because of exact match early return
       assert_redirected_to &quot;/action_pack_assertions/foo&quot;
     end
   end
 
+  def test_assert_redirected_to_top_level_named_route_with_same_controller_name_in_both_namespaces
+    with_routing do |set|
+      set.draw do |map|
+        # this controller exists in the admin namespace as well which is the only difference from previous test
+        map.top_level '/user/:id', :controller =&gt; 'user', :action =&gt; 'index'
+        map.connect   ':controller/:action/:id'
+      end
+      @controller = Admin::InnerModuleController.new
+      process :redirect_to_top_level_named_route
+      # assert_redirected_to top_level_url('foo') would pass because of exact match early return
+      assert_redirected_to top_level_path('foo')
+    end
+  end
+
   # -- standard request/response object testing --------------------------------
 
   # make sure that the template objects exist</diff>
      <filename>actionpack/test/controller/action_pack_assertions_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e3c26e9926948587efcc8d31c729395093407df6</id>
    </parent>
  </parents>
  <author>
    <name>Gabe da Silveira</name>
    <email>gabe@websaviour.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/025515b234d8380f195e3de3818d076302605b12</url>
  <id>025515b234d8380f195e3de3818d076302605b12</id>
  <committed-date>2008-06-03T16:08:58-07:00</committed-date>
  <authored-date>2008-06-02T15:57:35-07:00</authored-date>
  <message>Fix assert_redirected_to for nested controllers and named routes

[#308 state:resolved]

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;</message>
  <tree>ea615e7182e18f01443175a3c32797bb7e24636e</tree>
  <committer>
    <name>Michael Koziarski</name>
    <email>michael@koziarski.com</email>
  </committer>
</commit>
