diff options
author | Tom Stuart <tom@experthuman.com> | 2008-11-13 20:00:11 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-11-14 12:26:43 +0100 |
commit | 2ecec6052f7f290252a9fd9cc27ec804c7aad36c (patch) | |
tree | 4a692a5e956f72e32fe8e48686c4d99abdd3c89b /actionpack/test/controller | |
parent | 94d6716324126028b89dde886f160474049b1b0c (diff) | |
download | rails-2ecec6052f7f290252a9fd9cc27ec804c7aad36c.tar.gz rails-2ecec6052f7f290252a9fd9cc27ec804c7aad36c.tar.bz2 rails-2ecec6052f7f290252a9fd9cc27ec804c7aad36c.zip |
Make inheritance of map.resources :only/:except options behave more predictably
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/resources_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 1f1f7b8a2c..04f7a0a528 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -971,6 +971,32 @@ class ResourcesTest < Test::Unit::TestCase end end + def test_nested_resource_ignores_only_option + with_routing do |set| + set.draw do |map| + map.resources :products, :only => :show do |product| + product.resources :images, :except => :destroy + 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_nested_resource_ignores_except_option + with_routing do |set| + set.draw do |map| + map.resources :products, :except => :show do |product| + product.resources :images, :only => :destroy + end + end + + assert_resource_allowed_routes('images', { :product_id => '1' }, { :id => '2' }, :destroy, [:index, :new, :create, :show, :edit, :update], 'products/1/images') + assert_resource_allowed_routes('images', { :product_id => '1', :format => 'xml' }, { :id => '2' }, :destroy, [:index, :new, :create, :show, :edit, :update], 'products/1/images') + end + end + protected def with_restful_routing(*args) with_routing do |set| |