Fixed to_s bug with namespace routes (closes #10283) [johnb]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8216 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2007-11-26 22:41:28 +00:00
parent a0c925c0a3
commit 5e94f053cb
2 changed files with 21 additions and 1 deletions

View File

@@ -1012,7 +1012,7 @@ module ActionController
path = "/#{path}" unless path[0] == ?/
path = "#{path}/" unless path[-1] == ?/
path = "/#{options[:path_prefix].gsub(/^\//,'')}#{path}" if options[:path_prefix]
path = "/#{options[:path_prefix].to_s.gsub(/^\//,'')}#{path}" if options[:path_prefix]
segments = segments_for_route_path(path)
defaults, requirements, conditions = divide_route_options(segments, options)

View File

@@ -1994,6 +1994,26 @@ class RouteSetTest < Test::Unit::TestCase
assert_equal("index", request.path_parameters[:action])
end
def test_setting_root_in_namespace_using_symbol
assert_nothing_raised do
set.draw do |map|
map.namespace :admin do |admin|
admin.root :controller => 'home'
end
end
end
end
def test_setting_root_in_namespace_using_string
assert_nothing_raised do
set.draw do |map|
map.namespace 'admin' do |admin|
admin.root :controller => 'home'
end
end
end
end
end
class RoutingTest < Test::Unit::TestCase