From ec895189e4bed93f40ba96af7319a5fc046ad621 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 12 Aug 2015 16:29:33 -0700 Subject: pull `formatted` up the stack this reduces the number of times we have to mutate the options hash. --- actionpack/test/dispatch/mapper_test.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index edc6987e97..6ce0e34ec3 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -52,6 +52,15 @@ module ActionDispatch end end + def test_unscoped_formatted + fakeset = FakeSet.new + mapper = Mapper.new fakeset + mapper.get '/foo', :to => 'posts#index', :as => :main, :format => true + assert_equal({:controller=>"posts", :action=>"index"}, + fakeset.defaults.first) + assert_equal "/foo.:format", fakeset.conditions.first[:path_info] + end + def test_scoped_formatted fakeset = FakeSet.new mapper = Mapper.new fakeset @@ -77,7 +86,7 @@ module ActionDispatch def test_mapping_requirements options = { } scope = Mapper::Scope.new({}) - m = Mapper::Mapping.build(scope, FakeSet.new, '/store/:name(*rest)', nil, 'foo', 'bar', nil, [:get], options) + m = Mapper::Mapping.build(scope, FakeSet.new, '/store/:name(*rest)', nil, 'foo', 'bar', nil, [:get], nil, options) _, _, requirements, _ = m.to_route assert_equal(/.+?/, requirements[:rest]) end -- cgit v1.2.3