Do not show optional (.:format) block for wildcard route [#6605 state:resolved]
This will make the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default
This commit is contained in:
parent
15d3cc21f4
commit
2ddfdba9a0
@ -107,7 +107,7 @@ def normalize_path(path)
|
||||
if @options[:format] == false
|
||||
@options.delete(:format)
|
||||
path
|
||||
elsif path.include?(":format") || path.end_with?('/')
|
||||
elsif path.include?(":format") || path.end_with?('/') || path.match(/^\/?\*/)
|
||||
path
|
||||
else
|
||||
"#{path}(.:format)"
|
||||
|
@ -46,6 +46,13 @@ def test_map_more_slashes
|
||||
mapper.match '/one/two/', :to => 'posts#index', :as => :main
|
||||
assert_equal '/one/two(.:format)', fakeset.conditions.first[:path_info]
|
||||
end
|
||||
|
||||
def test_map_wildcard
|
||||
fakeset = FakeSet.new
|
||||
mapper = Mapper.new fakeset
|
||||
mapper.match '/*path', :to => 'pages#show', :as => :page
|
||||
assert_equal '/*path', fakeset.conditions.first[:path_info]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user