Fixed a globbed route issue where slashes were being escaped, causing assert_routing to fail. [#5135 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Brian Rose 2010-07-16 15:26:21 -06:00 committed by José Valim
parent d16c5cc99b
commit 622092d33e
2 changed files with 9 additions and 1 deletions

View File

@ -414,7 +414,8 @@ module ActionDispatch
elsif value.is_a?(Array)
value.map { |v| Rack::Mount::Utils.escape_uri(v.to_param) }.join('/')
else
Rack::Mount::Utils.escape_uri(value.to_param)
return nil unless param = value.to_param
param.split('/').map { |v| Rack::Mount::Utils.escape_uri(v) }.join("/")
end
end
{:parameterize => parameterize}

View File

@ -461,6 +461,13 @@ XML
def test_assert_routing_in_module
assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
end
def test_assert_routing_with_glob
with_routing do |set|
set.draw { |map| match('*path' => "pages#show") }
assert_routing('/company/about', { :controller => 'pages', :action => 'show', :path => 'company/about' })
end
end
def test_params_passing
get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'}