aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller')
-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)