From 60adf118a622bebe55f9e2cdfcf94287d3c031a7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 14 Aug 2015 09:49:53 -0700 Subject: implement the `asts` method in terms of paths / patterns Eventually I want to eliminate the FakeSet test class --- actionpack/test/dispatch/mapper_test.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 9049391930..dab15a909e 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -4,17 +4,20 @@ module ActionDispatch module Routing class MapperTest < ActiveSupport::TestCase class FakeSet < ActionDispatch::Routing::RouteSet - attr_reader :routes - alias :set :routes - def initialize - @routes = [] + @my_routes = [] + super end def resources_path_names {} end + def add_route(*args) + @my_routes << args + super + end + def request_class ActionDispatch::Request end @@ -23,24 +26,20 @@ module ActionDispatch RouteSet::Dispatcher end - def add_route(*args) - routes << args - end - def defaults - routes.map { |x| x[3] } + @my_routes.map { |x| x[3] } end def conditions - routes.map { |x| x[1] } + @my_routes.map { |x| x[1] } end def requirements - routes.map { |x| x[2] } + @my_routes.map { |x| x[2] } end def asts - conditions.map { |hash| hash[:parsed_path_info] } + routes.map(&:path).map(&:spec) end end -- cgit v1.2.3