diff --git a/railties/lib/rails/application/route_inspector.rb b/railties/lib/rails/application/route_inspector.rb index 5ca366c5f2..2ca0c68243 100644 --- a/railties/lib/rails/application/route_inspector.rb +++ b/railties/lib/rails/application/route_inspector.rb @@ -51,7 +51,7 @@ module Rails end def internal? - path =~ %r{/rails/info/properties|^/assets} + path =~ %r{/rails/info/properties|^#{Rails.application.config.assets.prefix}} end def engine? diff --git a/railties/test/application/route_inspect_test.rb b/railties/test/application/route_inspect_test.rb index fcfa87e395..7c0a379112 100644 --- a/railties/test/application/route_inspect_test.rb +++ b/railties/test/application/route_inspect_test.rb @@ -8,6 +8,11 @@ module ApplicationTests def setup @set = ActionDispatch::Routing::RouteSet.new @inspector = Rails::Application::RouteInspector.new + app = ActiveSupport::OrderedOptions.new + app.config = ActiveSupport::OrderedOptions.new + app.config.assets = ActiveSupport::OrderedOptions.new + app.config.assets.prefix = '/sprockets' + Rails.stubs(:application).returns(app) end def test_displaying_routes_for_engines @@ -144,5 +149,14 @@ module ApplicationTests output = @inspector.format @set.routes assert_equal [" /foo #{RackApp.name} {:constraint=>( my custom constraint )}"], output end + + def test_rake_routes_dont_show_app_mounted_in_assets_prefix + @set.draw do + match '/sprockets' => RackApp + end + output = @inspector.format @set.routes + assert_no_match(/RackApp/, output.first) + assert_no_match(/\/sprockets/, output.first) + end end end