Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ask the named routes collection if the route is defined

we should not be accessing internals to figure out if a method is
defined.
  • Loading branch information...
commit f889831ed65bea14b6b687bdaa4012d73d81b2a6 1 parent 0088b08
@tenderlove tenderlove authored
View
4 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -94,6 +94,10 @@ def initialize
@module = Module.new
end
+ def route_defined?(name)
+ @module.method_defined? name
+ end
+
def helper_names
@helpers.map(&:to_s)
end
View
2  actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -165,7 +165,7 @@ def with_routing
# ROUTES TODO: These assertions should really work in an integration context
def method_missing(selector, *args, &block)
- if defined?(@controller) && @controller && @routes && @routes.named_routes.helpers.include?(selector)
+ if defined?(@controller) && @controller && @routes && @routes.named_routes.route_defined?(selector)
@controller.send(selector, *args, &block)
else
super
Please sign in to comment.
Something went wrong with that request. Please try again.