From f889831ed65bea14b6b687bdaa4012d73d81b2a6 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <aaron.patterson@gmail.com>
Date: Tue, 29 Jul 2014 12:15:04 -0700
Subject: ask the named routes collection if the route is defined

we should not be accessing internals to figure out if a method is
defined.
---
 actionpack/lib/action_dispatch/routing/route_set.rb          | 4 ++++
 actionpack/lib/action_dispatch/testing/assertions/routing.rb | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 14c5d663a3..c2583e2be6 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -94,6 +94,10 @@ module ActionDispatch
           @module  = Module.new
         end
 
+        def route_defined?(name)
+          @module.method_defined? name
+        end
+
         def helper_names
           @helpers.map(&:to_s)
         end
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index f1f998d932..2cf38a9c2d 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -165,7 +165,7 @@ module ActionDispatch
 
       # 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
-- 
cgit v1.2.3