diff options
author | Tarmo Tänav <tarmo@itech.ee> | 2009-01-30 13:37:59 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-01 14:47:56 +1300 |
commit | 80747e9db16ec60eb0d95b510baf051612ec0768 (patch) | |
tree | 062a879107363bb72d77633473fca803d4afaa47 /actionpack/test/controller | |
parent | ec8f04584479aff895b0b511a7ba1e9d33f84067 (diff) | |
download | rails-80747e9db16ec60eb0d95b510baf051612ec0768.tar.gz rails-80747e9db16ec60eb0d95b510baf051612ec0768.tar.bz2 rails-80747e9db16ec60eb0d95b510baf051612ec0768.zip |
Removed map.resources :only/:except inheritance
It's very rare for these options to apply identically to nested child resources, and with this inheritance on it's very difficult to have a child resource with more actions than the parent.
This reverts commit 2ecec6052f7f290252a9fd9cc27ec804c7aad36c.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1826 state:committed]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/resources_test.rb | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 8dedeb23f6..ae2639d245 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -942,19 +942,6 @@ class ResourcesTest < ActionController::TestCase end end - def test_nested_resource_inherits_only_show_action - with_routing do |set| - set.draw do |map| - map.resources :products, :only => :show do |product| - product.resources :images - end - end - - assert_resource_allowed_routes('images', { :product_id => '1' }, { :id => '2' }, :show, [:index, :new, :create, :edit, :update, :destroy], 'products/1/images') - assert_resource_allowed_routes('images', { :product_id => '1', :format => 'xml' }, { :id => '2' }, :show, [:index, :new, :create, :edit, :update, :destroy], 'products/1/images') - end - end - def test_nested_resource_has_only_show_and_member_action with_routing do |set| set.draw do |map| @@ -971,7 +958,7 @@ class ResourcesTest < ActionController::TestCase end end - def test_nested_resource_ignores_only_option + def test_nested_resource_does_not_inherit_only_option with_routing do |set| set.draw do |map| map.resources :products, :only => :show do |product| @@ -984,7 +971,20 @@ class ResourcesTest < ActionController::TestCase end end - def test_nested_resource_ignores_except_option + def test_nested_resource_does_not_inherit_only_option_by_default + with_routing do |set| + set.draw do |map| + map.resources :products, :only => :show do |product| + product.resources :images + end + end + + assert_resource_allowed_routes('images', { :product_id => '1' }, { :id => '2' }, [:index, :new, :create, :show, :edit, :update, :destory], [], 'products/1/images') + assert_resource_allowed_routes('images', { :product_id => '1', :format => 'xml' }, { :id => '2' }, [:index, :new, :create, :show, :edit, :update, :destroy], [], 'products/1/images') + end + end + + def test_nested_resource_does_not_inherit_except_option with_routing do |set| set.draw do |map| map.resources :products, :except => :show do |product| @@ -997,6 +997,19 @@ class ResourcesTest < ActionController::TestCase end end + def test_nested_resource_does_not_inherit_except_option_by_default + with_routing do |set| + set.draw do |map| + map.resources :products, :except => :show do |product| + product.resources :images + end + end + + assert_resource_allowed_routes('images', { :product_id => '1' }, { :id => '2' }, [:index, :new, :create, :show, :edit, :update, :destroy], [], 'products/1/images') + assert_resource_allowed_routes('images', { :product_id => '1', :format => 'xml' }, { :id => '2' }, [:index, :new, :create, :show, :edit, :update, :destroy], [], 'products/1/images') + end + end + def test_default_singleton_restful_route_uses_get with_routing do |set| set.draw do |map| |