diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-01-14 16:33:21 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2012-01-15 10:52:25 -0500 |
commit | 666f9316ebaa13d594c6b66e095096c52d82e3f1 (patch) | |
tree | 761c98c7a807d12d2c3ff6be90709ed7d00c16f6 /railties | |
parent | dee595ce04b65d27294912faff146ed402ded6d1 (diff) | |
download | rails-666f9316ebaa13d594c6b66e095096c52d82e3f1.tar.gz rails-666f9316ebaa13d594c6b66e095096c52d82e3f1.tar.bz2 rails-666f9316ebaa13d594c6b66e095096c52d82e3f1.zip |
Don't hardcode assets route skipped in route inspector
Conflicts:
railties/lib/rails/application/route_inspector.rb
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application/route_inspector.rb | 2 | ||||
-rw-r--r-- | railties/test/application/route_inspect_test.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/railties/lib/rails/application/route_inspector.rb b/railties/lib/rails/application/route_inspector.rb index 3e08b78221..01cde0a6e7 100644 --- a/railties/lib/rails/application/route_inspector.rb +++ b/railties/lib/rails/application/route_inspector.rb @@ -42,7 +42,7 @@ module Rails end # Skip the route if it's internal info route - routes.reject { |r| r[:path] =~ %r{/rails/info/properties|^/assets} } + routes.reject { |r| r[:path] =~ %r{/rails/info/properties|^#{Rails.application.config.assets.prefix}} } end def collect_engine_routes(name, rack_app) diff --git a/railties/test/application/route_inspect_test.rb b/railties/test/application/route_inspect_test.rb index 6503251b9f..b897cf15b8 100644 --- a/railties/test/application/route_inspect_test.rb +++ b/railties/test/application/route_inspect_test.rb @@ -1,4 +1,5 @@ require 'test/unit' +require 'mocha' require 'rails/application/route_inspector' require 'action_controller' require 'rails/engine' @@ -8,6 +9,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 +150,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 |