mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't hardcode assets route skipped in route inspector
This commit is contained in:
parent
f4b1dcdbcf
commit
0802dc7f4f
2 changed files with 15 additions and 1 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue