mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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:
parent
d16c5cc99b
commit
622092d33e
2 changed files with 9 additions and 1 deletions
|
@ -414,7 +414,8 @@ module ActionDispatch
|
||||||
elsif value.is_a?(Array)
|
elsif value.is_a?(Array)
|
||||||
value.map { |v| Rack::Mount::Utils.escape_uri(v.to_param) }.join('/')
|
value.map { |v| Rack::Mount::Utils.escape_uri(v.to_param) }.join('/')
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
{:parameterize => parameterize}
|
{:parameterize => parameterize}
|
||||||
|
|
|
@ -461,6 +461,13 @@ XML
|
||||||
def test_assert_routing_in_module
|
def test_assert_routing_in_module
|
||||||
assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
|
assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
|
||||||
end
|
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
|
def test_params_passing
|
||||||
get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'}
|
get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'}
|
||||||
|
|
Loading…
Reference in a new issue