From aa3565f3a6327c947ded314525ba1d0674d5a71e Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Wed, 23 Dec 2009 23:33:14 -0500 Subject: Allow named_routes to be used with root, and with new DSL short-form. The real use case it to make all of the following act the same: root 'store#index', :as => 'store' match '/' => 'store#index', :as => 'store' match '/', :to => 'store#index', :as => 'store' The test case provided deviates from this in order to demonstrate all three forms in a single set of test routes. Signed-off-by: Jeremy Kemper --- actionpack/test/dispatch/routing_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 7ca85a4201..82231cb3d9 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -111,6 +111,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end root :to => 'projects#index' + match '/info' => 'projects#info', :as => 'info' end end @@ -469,6 +470,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_index + with_test_routes do + assert_equal '/info', info_path + get '/info' + assert_equal 'projects#info', @response.body + end + end + private def with_test_routes real_routes, temp_routes = ActionController::Routing::Routes, Routes -- cgit v1.2.3