mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #25499 from nfm/backport-fix-rails-info-routes-for-apps-with-globbing-route
Fix rails/info routes for apps with globbing route
This commit is contained in:
commit
3d9d4f56c1
3 changed files with 27 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
* Ensure `/rails/info` routes match in development for apps with a catch-all globbing route.
|
||||
|
||||
*Nicholas Firth-McCoy*
|
||||
|
||||
## Rails 5.0.0.rc2 (June 22, 2016) ##
|
||||
|
||||
* No changes.
|
||||
|
|
|
@ -21,10 +21,13 @@ module Rails
|
|||
|
||||
initializer :add_builtin_route do |app|
|
||||
if Rails.env.development?
|
||||
app.routes.append do
|
||||
app.routes.prepend do
|
||||
get '/rails/info/properties' => "rails/info#properties", internal: true
|
||||
get '/rails/info/routes' => "rails/info#routes", internal: true
|
||||
get '/rails/info' => "rails/info#index", internal: true
|
||||
end
|
||||
|
||||
app.routes.append do
|
||||
get '/' => "rails/welcome#index", internal: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,6 +39,25 @@ module ApplicationTests
|
|||
assert_equal 200, last_response.status
|
||||
end
|
||||
|
||||
test "/rails/info routes are accessible with globbing route present" do
|
||||
app("development")
|
||||
|
||||
app_file "config/routes.rb", <<-RUBY
|
||||
Rails.application.routes.draw do
|
||||
get '*foo', to: 'foo#index'
|
||||
end
|
||||
RUBY
|
||||
|
||||
get "/rails/info"
|
||||
assert_equal 302, last_response.status
|
||||
|
||||
get "rails/info/routes"
|
||||
assert_equal 200, last_response.status
|
||||
|
||||
get "rails/info/properties"
|
||||
assert_equal 200, last_response.status
|
||||
end
|
||||
|
||||
test "root takes precedence over internal welcome controller" do
|
||||
app("development")
|
||||
|
||||
|
|
Loading…
Reference in a new issue