1
0
Fork 0
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:
Rafael França 2016-06-23 23:51:14 -03:00 committed by GitHub
commit 3d9d4f56c1
3 changed files with 27 additions and 1 deletions

View file

@ -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.

View file

@ -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

View file

@ -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")