Changeset 8801
- Timestamp:
- 02/04/08 23:26:25 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2-0-stable/actionpack/lib/action_controller/assertions/response_assertions.rb
r8585 r8801 96 96 if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/') 97 97 new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) 98 value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path) 98 value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path) && @response.redirected_to.is_a?(Hash) 99 99 end 100 100 value['controller'] = value['controller'][1..-1] if value['controller'].first == '/' # strip leading hash branches/2-0-stable/actionpack/test/controller/action_pack_assertions_test.rb
r8585 r8801 134 134 end 135 135 136 class UserController < ActionController::Base 137 end 138 136 139 module Admin 137 140 class InnerModuleController < ActionController::Base … … 171 174 def setup 172 175 ActionController::Routing::Routes.reload 173 ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module content admin/user))176 ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module user content admin/user)) 174 177 @controller = ActionPackAssertionsController.new 175 178 @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new … … 265 268 end 266 269 end 267 270 268 271 def test_assert_redirected_to_top_level_named_route_from_nested_controller 269 272 with_routing do |set| … … 276 279 # passes -> assert_redirected_to "http://test.host/action_pack_assertions/foo" 277 280 assert_redirected_to "/action_pack_assertions/foo" 281 end 282 end 283 284 285 def test_assert_redirected_to_top_level_named_route_with_same_controller_name_in_both_namespaces 286 with_routing do |set| 287 set.draw do |map| 288 # this controller exists in the admin namespace as well which is the only difference from previous test 289 map.top_level '/user/:id', :controller => 'user', :action => 'index' 290 map.connect ':controller/:action/:id' 291 end 292 @controller = Admin::InnerModuleController.new 293 process :redirect_to_top_level_named_route 294 assert_redirected_to "/user/foo" 278 295 end 279 296 end