aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-14 09:49:53 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-14 10:39:32 -0700
commit60adf118a622bebe55f9e2cdfcf94287d3c031a7 (patch)
treef92be06874a2bfde49dfa48ed2f4e907c82a2a9b /actionpack
parent61437232a9205ae4890f6d7491a97217b63c45c1 (diff)
downloadrails-60adf118a622bebe55f9e2cdfcf94287d3c031a7.tar.gz
rails-60adf118a622bebe55f9e2cdfcf94287d3c031a7.tar.bz2
rails-60adf118a622bebe55f9e2cdfcf94287d3c031a7.zip
implement the `asts` method in terms of paths / patterns
Eventually I want to eliminate the FakeSet test class
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/dispatch/mapper_test.rb23
1 files changed, 11 insertions, 12 deletions
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