Permalink
Browse files

Don't hardcode assets route skipped in route inspector

Conflicts:

	railties/lib/rails/application/route_inspector.rb
  • Loading branch information...
1 parent dee595c commit 666f9316ebaa13d594c6b66e095096c52d82e3f1 @guilleiguaran committed Jan 14, 2012
@@ -42,7 +42,7 @@ def collect_routes(routes)
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)
@@ -1,4 +1,5 @@
require 'test/unit'
+require 'mocha'
require 'rails/application/route_inspector'
require 'action_controller'
require 'rails/engine'
@@ -8,6 +9,11 @@ class RouteInspectTest < Test::Unit::TestCase
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 @@ def to_s
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

0 comments on commit 666f931

Please sign in to comment.