Changeset 5785
- Timestamp:
- 12/25/06 09:34:01 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/assertions/response_assertions.rb
r5466 r5785 71 71 if value.respond_to?(:[]) && value['controller'] 72 72 if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/') 73 value['controller'] = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) 73 new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) 74 value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path) 74 75 end 75 76 value['controller'] = value['controller'][1..-1] if value['controller'].first == '/' # strip leading hash … … 77 78 url[key] = value 78 79 end 79 80 80 81 81 @response_diff = url[:expected].diff(url[:actual]) if url[:actual] trunk/actionpack/test/controller/action_pack_assertions_test.rb
r5646 r5785 140 140 redirect_to :controller => 'user' 141 141 end 142 143 def redirect_to_top_level_named_route 144 redirect_to top_level_url(:id => "foo") 145 end 142 146 end 143 147 end … … 151 155 ActionPackAssertionsController.template_root = File.dirname(__FILE__) + "/../fixtures/" 152 156 153 154 157 # a test case to exercise the new capabilities TestRequest & TestResponse 155 158 class ActionPackAssertionsControllerTest < Test::Unit::TestCase 156 159 # let's get this party started 157 160 def setup 161 ActionController::Routing::Routes.reload 162 ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module content admin/user)) 158 163 @controller = ActionPackAssertionsController.new 159 164 @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new 165 end 166 167 def teardown 168 ActionController::Routing::Routes.reload 160 169 end 161 170 … … 295 304 end 296 305 end 306 307 def test_assert_redirected_to_top_level_named_route_from_nested_controller 308 with_routing do |set| 309 set.draw do |map| 310 map.top_level '/action_pack_assertions/:id', :controller => 'action_pack_assertions', :action => 'index' 311 map.connect ':controller/:action/:id' 312 end 313 @controller = Admin::InnerModuleController.new 314 process :redirect_to_top_level_named_route 315 # passes -> assert_redirected_to "http://test.host/action_pack_assertions/foo" 316 assert_redirected_to "/action_pack_assertions/foo" 317 end 318 end 297 319 298 320 # test the flash-based assertions with something is in the flash trunk/actionpack/test/controller/test_test.rb
r5643 r5785 87 87 @response = ActionController::TestResponse.new 88 88 ActionController::Routing::Routes.reload 89 ActionController::Routing.use_controllers! %w(content admin/user )89 ActionController::Routing.use_controllers! %w(content admin/user test_test/test) 90 90 end 91 91