aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-10 14:31:44 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-10 14:31:44 +0000
commitb611c685d92038b199149e8eec900c3058523ab7 (patch)
tree4bd81aa0be6d0a39da2a415f3b6fabe0310dbcbc /actionpack/test
parentbf8a4b000602a12ba04d105b9c97f900c410e341 (diff)
downloadrails-b611c685d92038b199149e8eec900c3058523ab7.tar.gz
rails-b611c685d92038b199149e8eec900c3058523ab7.tar.bz2
rails-b611c685d92038b199149e8eec900c3058523ab7.zip
Fixed that resource namespaces wouldnt stick to all nested resources (closes #9399) [pixeltrix]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7447 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/resources_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 29c25e6cfc..d28089da0c 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -19,9 +19,11 @@ module Backoffice
class ProductsController < ResourcesController; end
class TagsController < ResourcesController; end
class ManufacturersController < ResourcesController; end
+ class ImagesController < ResourcesController; end
module Admin
class ProductsController < ResourcesController; end
+ class ImagesController < ResourcesController; end
end
end
@@ -576,6 +578,36 @@ class ResourcesTest < Test::Unit::TestCase
assert_simply_restful_for :products, :controller => "backoffice/products"
end
end
+
+ def test_nested_resources_using_namespace
+ with_routing do |set|
+ set.draw do |map|
+ map.namespace :backoffice do |backoffice|
+ backoffice.resources :products do |products|
+ products.resources :images
+ end
+ end
+ end
+
+ assert_simply_restful_for :images, :controller => "backoffice/images", :name_prefix => 'backoffice_product_', :path_prefix => 'backoffice/products/1/', :options => {:product_id => '1'}
+ end
+ end
+
+ def test_nested_resources_in_nested_namespace
+ with_routing do |set|
+ set.draw do |map|
+ map.namespace :backoffice do |backoffice|
+ backoffice.namespace :admin do |admin|
+ admin.resources :products do |products|
+ products.resources :images
+ end
+ end
+ end
+ end
+
+ assert_simply_restful_for :images, :controller => "backoffice/admin/images", :name_prefix => 'backoffice_admin_product_', :path_prefix => 'backoffice/admin/products/1/', :options => {:product_id => '1'}
+ end
+ end
protected
def with_restful_routing(*args)