aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 18fcef5bc5..9e48b5391d 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -376,7 +376,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase
def test_named_url_with_no_action_specified
rs.draw do |map|
- map.root '', :controller => 'content'
+ map.home '', :controller => 'content'
map.connect ':controller/:action/:id'
end
@@ -384,14 +384,14 @@ class LegacyRouteSetTests < Test::Unit::TestCase
assert_equal '/', rs.generate(:controller => 'content')
x = setup_for_named_route.new
- assert_equal({:controller => 'content', :action => 'index', :use_route => :root, :only_path => false},
- x.send(:root_url))
+ assert_equal({:controller => 'content', :action => 'index', :use_route => :home, :only_path => false},
+ x.send(:home_url))
end
def test_url_generated_when_forgetting_action
[{:controller => 'content', :action => 'index'}, {:controller => 'content'}].each do |hash|
rs.draw do |map|
- map.root '', hash
+ map.home '', hash
map.connect ':controller/:action/:id'
end
assert_equal '/', rs.generate({:action => nil}, {:controller => 'content', :action => 'hello'})
@@ -1592,6 +1592,20 @@ class RouteSetTest < Test::Unit::TestCase
assert_equal "/people/list", url
end
+ def test_root_map
+ Object.const_set(:PeopleController, Class.new)
+
+ set.draw { |map| map.root :controller => "people" }
+
+ request.path = ""
+ request.method = :get
+ assert_nothing_raised { set.recognize(request) }
+ assert_equal("people", request.path_parameters[:controller])
+ assert_equal("index", request.path_parameters[:action])
+ ensure
+ Object.send(:remove_const, :PeopleController)
+ end
+
def test_generate_finds_best_fit
set.draw do |map|
map.connect "/people", :controller => "people", :action => "index"