1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

make the routes reader private

nobody should be touching the routes hash without going through the
NamedRouteCollection object.
This commit is contained in:
Aaron Patterson 2015-08-18 16:33:18 -07:00
parent 62383ddecc
commit 7187339854
2 changed files with 2 additions and 1 deletions

View file

@ -89,6 +89,7 @@ module ActionDispatch
class NamedRouteCollection
include Enumerable
attr_reader :routes, :url_helpers_module, :path_helpers_module
private :routes
def initialize
@routes = {}

View file

@ -49,7 +49,7 @@ class TestRoutingMount < ActionDispatch::IntegrationTest
def test_app_name_is_properly_generated_when_engine_is_mounted_in_resources
assert Router.mounted_helpers.method_defined?(:user_fake_mounted_at_resource),
"A mounted helper should be defined with a parent's prefix"
assert Router.named_routes.routes[:user_fake_mounted_at_resource],
assert Router.named_routes.key?(:user_fake_mounted_at_resource),
"A named route should be defined with a parent's prefix"
end