diff options
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/mapper_test.rb | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 289fb69b8b..8c1b53041a 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -4,20 +4,10 @@ module ActionDispatch module Routing class MapperTest < ActiveSupport::TestCase class FakeSet < ActionDispatch::Routing::RouteSet - def initialize - @my_routes = [] - super - end - def resources_path_names {} end - def add_route(*args) - @my_routes << args - super - end - def request_class ActionDispatch::Request end @@ -27,11 +17,11 @@ module ActionDispatch end def defaults - @my_routes.map { |x| x[4] } + routes.map(&:defaults) end def conditions - @my_routes.map { |x| x[1] } + routes.map(&:constraints) end def requirements @@ -92,7 +82,7 @@ module ActionDispatch end assert_equal({:omg=>:awesome, :controller=>"posts", :action=>"index"}, fakeset.defaults.first) - assert_equal ["GET"], fakeset.conditions.first[:request_method] + assert_equal(/^GET$/, fakeset.conditions.first[:request_method]) end def test_mapping_requirements @@ -100,8 +90,7 @@ module ActionDispatch scope = Mapper::Scope.new({}) ast = Journey::Parser.parse '/store/:name(*rest)' m = Mapper::Mapping.build(scope, FakeSet.new, ast, 'foo', 'bar', nil, [:get], nil, {}, options) - _, _, requirements, _ = m.to_route - assert_equal(/.+?/, requirements[:rest]) + assert_equal(/.+?/, m.requirements[:rest]) end def test_via_scope @@ -110,7 +99,7 @@ module ActionDispatch mapper.scope(via: :put) do mapper.match '/', :to => 'posts#index', :as => :main end - assert_equal ["PUT"], fakeset.conditions.first[:request_method] + assert_equal(/^PUT$/, fakeset.conditions.first[:request_method]) end def test_map_slash |