Changeset 4757
- Timestamp:
- 08/13/06 18:31:58 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/assertions.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/action_pack_assertions_test.rb (modified) (2 diffs)
- trunk/actionpack/test/controller/routing_test.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r4756 r4757 1 1 *SVN* 2 3 * Fix assert_redirected_to issue with named routes for module controllers. [Rick Olson] 2 4 3 5 * Tweak RoutingError message to show option diffs, not just missing named route significant keys. [Rick Olson] trunk/actionpack/lib/action_controller/assertions.rb
r4649 r4757 109 109 110 110 if value.respond_to?(:[]) && value['controller'] 111 if key == :actual && value['controller'].first != '/' 111 if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/') 112 112 value['controller'] = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path) 113 113 end … … 116 116 url[key] = value 117 117 end 118 118 119 119 120 @response_diff = url[:expected].diff(url[:actual]) if url[:actual] trunk/actionpack/test/controller/action_pack_assertions_test.rb
r4715 r4757 125 125 module Admin 126 126 class InnerModuleController < ActionController::Base 127 def index 128 render :nothing => true 129 end 130 131 def redirect_to_index 132 redirect_to admin_inner_module_path 133 end 134 127 135 def redirect_to_absolute_controller 128 136 redirect_to :controller => '/content' 129 137 end 138 130 139 def redirect_to_fellow_controller 131 140 redirect_to :controller => 'user' … … 268 277 end 269 278 279 def test_assert_redirect_to_nested_named_route 280 with_routing do |set| 281 set.draw do |map| 282 map.admin_inner_module 'admin/inner_module', :controller => 'admin/inner_module', :action => 'index' 283 map.connect ':controller/:action/:id' 284 end 285 @controller = Admin::InnerModuleController.new 286 process :redirect_to_index 287 # redirection is <{"action"=>"index", "controller"=>"admin/admin/inner_module"}> 288 assert_redirected_to admin_inner_module_path 289 end 290 end 291 270 292 # test the flash-based assertions with something is in the flash 271 293 def test_flash_assertions_full trunk/actionpack/test/controller/routing_test.rb
r4677 r4757 133 133 x.send(:page_url, :title => "AboutRails")) 134 134 135 end 136 137 def test_named_route_with_nested_controller 138 rs.add_named_route :users, 'admin/user', :controller => '/admin/user', :action => 'index' 139 x = setup_for_named_route.new 140 assert_equal({:controller => '/admin/user', :action => 'index', :use_route => :users}, 141 x.send(:users_url)) 135 142 end 136 143 … … 1178 1185 map.index '/people', :controller => 'people', :action => 'index' 1179 1186 map.multi '/people/go/:foo/:bar/joe/:id', :controller => 'people', :action => 'multi' 1187 map.users '/admin/users', :controller => 'admin/users', :action => 'index' 1180 1188 end 1181 1189 … … 1210 1218 assert_equal "http://named.route.test/people", controller.send(:index_url) 1211 1219 assert_equal "/people", controller.send(:index_path) 1220 1221 assert_equal "http://named.route.test/admin/users", controller.send(:users_url) 1222 assert_equal '/admin/users', controller.send(:users_path) 1223 assert_equal '/admin/users', set.generate(controller.send(:hash_for_users_url), {:controller => 'users', :action => 'index'}) 1212 1224 end 1213 1225