diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-03 06:34:24 -0700 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-03 06:34:24 -0700 |
commit | 5120e5596c7e5cb58004cb264e93a4670ee0e8f6 (patch) | |
tree | 25bf88a6b50dda6a5191cbdae7daa21c190e59a9 /actionpack | |
parent | 979adea8787ef88f62b8dcc1962ae8ce3481978b (diff) | |
parent | 33971922b3af559d6583b472d1520bc4d13daccc (diff) | |
download | rails-5120e5596c7e5cb58004cb264e93a4670ee0e8f6.tar.gz rails-5120e5596c7e5cb58004cb264e93a4670ee0e8f6.tar.bz2 rails-5120e5596c7e5cb58004cb264e93a4670ee0e8f6.zip |
Merge pull request #10072 from senny/10071_format_on_scope_block_is_ignored
fix regression in Mapper when `format:` was used in a `scope`.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index c5f2b33602..399f6529a7 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -58,8 +58,8 @@ module ActionDispatch @set, @scope, @path, @options = set, scope, path, options @requirements, @conditions, @defaults = {}, {}, {} - normalize_path! normalize_options! + normalize_path! normalize_requirements! normalize_conditions! normalize_defaults! diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index df359ba77d..643c83dc91 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -1102,6 +1102,28 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'projects#index', @response.body end + def test_scope_with_format_option + draw do + get "direct/index", as: :no_format_direct, format: false + + scope format: false do + get "scoped/index", as: :no_format_scoped + end + end + + assert_equal "/direct/index", no_format_direct_path + assert_equal "/direct/index?format=html", no_format_direct_path(format: "html") + + assert_equal "/scoped/index", no_format_scoped_path + assert_equal "/scoped/index?format=html", no_format_scoped_path(format: "html") + + get '/scoped/index' + assert_equal "scoped#index", @response.body + + get '/scoped/index.html' + assert_equal "Not Found", @response.body + end + def test_index draw do get '/info' => 'projects#info', :as => 'info' |