mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix optionally scoped root route unscoped access
This commit is contained in:
parent
8e123847e8
commit
7670d60977
2 changed files with 17 additions and 1 deletions
|
@ -390,7 +390,7 @@ module ActionDispatch
|
|||
# for root cases, where the latter is the correct one.
|
||||
def self.normalize_path(path)
|
||||
path = Journey::Router::Utils.normalize_path(path)
|
||||
path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^)]+\)$}
|
||||
path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/(\(+[^)]+\)){1,}$}
|
||||
path
|
||||
end
|
||||
|
||||
|
|
|
@ -1367,6 +1367,22 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
|||
assert_equal "projects#index", @response.body
|
||||
end
|
||||
|
||||
def test_optionally_scoped_root_unscoped_access
|
||||
draw do
|
||||
scope "(:locale)" do
|
||||
scope "(:platform)" do
|
||||
scope "(:browser)" do
|
||||
root to: "projects#index"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal "/", root_path
|
||||
get "/"
|
||||
assert_equal "projects#index", @response.body
|
||||
end
|
||||
|
||||
def test_scope_with_format_option
|
||||
draw do
|
||||
get "direct/index", as: :no_format_direct, format: false
|
||||
|
|
Loading…
Reference in a new issue