diff options
Diffstat (limited to 'actionpack/test/controller/resources_test.rb')
-rw-r--r-- | actionpack/test/controller/resources_test.rb | 340 |
1 files changed, 168 insertions, 172 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 4505cdabae..86d854c962 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' require 'active_support/core_ext/object/try' +require 'active_support/core_ext/object/with_options' class ResourcesController < ActionController::Base def index() render :nothing => true end @@ -32,36 +33,6 @@ module Backoffice end class ResourcesTest < ActionController::TestCase - def test_should_arrange_actions - resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, { - :collection => { :rss => :get, :reorder => :post, :csv => :post }, - :member => { :rss => :get, :atom => :get, :upload => :post, :fix => :post }, - :new => { :preview => :get, :draft => :get }}, {}) - - assert_resource_methods [:rss], resource, :collection, :get - assert_resource_methods [:csv, :reorder], resource, :collection, :post - assert_resource_methods [:edit, :rss, :atom], resource, :member, :get - assert_resource_methods [:upload, :fix], resource, :member, :post - assert_resource_methods [:new, :preview, :draft], resource, :new, :get - end - - def test_should_resource_controller_name_equal_resource_name_by_default - resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, {}, {}) - assert_equal 'messages', resource.controller - end - - def test_should_resource_controller_name_equal_controller_option - resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, {:controller => 'posts'}, {}) - assert_equal 'posts', resource.controller - end - - def test_should_all_singleton_paths_be_the_same - [ :path, :nesting_path_prefix, :member_path ].each do |method| - resource = ActionDispatch::Routing::DeprecatedMapper::SingletonResource.new(:messages, {:path_prefix => 'admin'}, {}) - assert_equal 'admin/messages', resource.send(method) - end - end - def test_default_restful_routes with_restful_routing :messages do assert_simply_restful_for :messages @@ -69,9 +40,9 @@ class ResourcesTest < ActionController::TestCase end def test_override_paths_for_member_and_collection_methods - collection_methods = { 'rss' => :get, 'reorder' => :post, 'csv' => :post } - member_methods = { 'rss' => :get, :atom => :get, :upload => :post, :fix => :post } - path_names = {:new => 'nuevo', 'rss' => 'canal', :fix => 'corrigir' } + collection_methods = { :rss => :get, :reorder => :post, :csv => :post } + member_methods = { :rss => :get, :atom => :get, :upload => :post, :fix => :post } + path_names = {:new => 'nuevo', :rss => 'canal', :fix => 'corrigir' } with_restful_routing :messages, :collection => collection_methods, @@ -89,7 +60,7 @@ class ResourcesTest < ActionController::TestCase end collection_methods.each do |action, method| - assert_recognizes(options.merge(:action => action), + assert_recognizes(options.merge(:action => action.to_s), :path => "/messages/#{path_names[action] || action}", :method => method) end @@ -112,12 +83,6 @@ class ResourcesTest < ActionController::TestCase end end - def test_override_paths_for_default_restful_actions - resource = ActionDispatch::Routing::DeprecatedMapper::Resource.new(:messages, { - :path_names => {:new => 'nuevo', :edit => 'editar'}}, {}) - assert_equal resource.new_path, "#{resource.path}/nuevo" - end - def test_multiple_default_restful_routes with_restful_routing :messages, :comments do assert_simply_restful_for :messages @@ -131,7 +96,7 @@ class ResourcesTest < ActionController::TestCase end end - def test_irregular_id_with_no_requirements_should_raise_error + def test_irregular_id_with_no_constraints_should_raise_error expected_options = {:controller => 'messages', :action => 'show', :id => '1.1.1'} with_restful_routing :messages do @@ -141,25 +106,25 @@ class ResourcesTest < ActionController::TestCase end end - def test_irregular_id_with_requirements_should_pass + def test_irregular_id_with_constraints_should_pass expected_options = {:controller => 'messages', :action => 'show', :id => '1.1.1'} - with_restful_routing(:messages, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}) do + with_restful_routing(:messages, :constraints => {:id => /[0-9]\.[0-9]\.[0-9]/}) do assert_recognizes(expected_options, :path => 'messages/1.1.1', :method => :get) end end - def test_with_path_prefix_requirements + def test_with_path_prefix_constraints expected_options = {:controller => 'messages', :action => 'show', :thread_id => '1.1.1', :id => '1'} - with_restful_routing :messages, :path_prefix => '/thread/:thread_id', :requirements => {:thread_id => /[0-9]\.[0-9]\.[0-9]/} do + with_restful_routing :messages, :path_prefix => '/thread/:thread_id', :constraints => {:thread_id => /[0-9]\.[0-9]\.[0-9]/} do assert_recognizes(expected_options, :path => 'thread/1.1.1/messages/1', :method => :get) end end - def test_irregular_id_requirements_should_get_passed_to_member_actions + def test_irregular_id_constraints_should_get_passed_to_member_actions expected_options = {:controller => 'messages', :action => 'custom', :id => '1.1.1'} - with_restful_routing(:messages, :member => {:custom => :get}, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}) do + with_restful_routing(:messages, :member => {:custom => :get}, :constraints => {:id => /[0-9]\.[0-9]\.[0-9]/}) do assert_recognizes(expected_options, :path => 'messages/1.1.1/custom', :method => :get) end end @@ -274,7 +239,7 @@ class ResourcesTest < ActionController::TestCase def test_with_member_action_and_requirement expected_options = {:controller => 'messages', :action => 'mark', :id => '1.1.1'} - with_restful_routing(:messages, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}, :member => { :mark => :get }) do + with_restful_routing(:messages, :constraints => {:id => /[0-9]\.[0-9]\.[0-9]/}, :member => { :mark => :get }) do assert_recognizes(expected_options, :path => 'messages/1.1.1/mark', :method => :get) end end @@ -411,10 +376,10 @@ class ResourcesTest < ActionController::TestCase def test_nested_restful_routes with_routing do |set| - set.draw do |map| - map.resources :threads do |map| - map.resources :messages do |map| - map.resources :comments + set.draw do + resources :threads do + resources :messages do + resources :comments end end end @@ -433,10 +398,10 @@ class ResourcesTest < ActionController::TestCase def test_nested_restful_routes_with_overwritten_defaults with_routing do |set| - set.draw do |map| - map.resources :threads do |map| - map.resources :messages, :name_prefix => nil do |map| - map.resources :comments, :name_prefix => nil + set.draw do + resources :threads do + resources :messages, :name_prefix => nil do + resources :comments, :name_prefix => nil end end end @@ -453,10 +418,10 @@ class ResourcesTest < ActionController::TestCase def test_shallow_nested_restful_routes with_routing do |set| - set.draw do |map| - map.resources :threads, :shallow => true do |map| - map.resources :messages do |map| - map.resources :comments + set.draw do + resources :threads, :shallow => true do + resources :messages do + resources :comments end end end @@ -478,11 +443,11 @@ class ResourcesTest < ActionController::TestCase def test_shallow_nested_restful_routes_with_namespaces with_routing do |set| - set.draw do |map| - map.namespace :backoffice do |map| - map.namespace :admin do |map| - map.resources :products, :shallow => true do |map| - map.resources :images + set.draw do + namespace :backoffice do + namespace :admin do + resources :products, :shallow => true do + resources :images end end end @@ -531,9 +496,9 @@ class ResourcesTest < ActionController::TestCase def test_should_create_nested_singleton_resource_routes with_routing do |set| - set.draw do |map| - map.resource :admin, :controller => 'admin' do |admin| - admin.resource :account + set.draw do + resource :admin, :controller => 'admin' do + resource :account end end @@ -544,8 +509,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_many_should_become_nested_resources with_routing do |set| - set.draw do |map| - map.resources :messages, :has_many => [ :comments, :authors ] + set.draw do + resources :messages, :has_many => [ :comments, :authors ] end assert_simply_restful_for :messages @@ -556,8 +521,8 @@ class ResourcesTest < ActionController::TestCase def test_resources_has_many_hash_should_become_nested_resources with_routing do |set| - set.draw do |map| - map.resources :threads, :has_many => { :messages => [ :comments, { :authors => :threads } ] } + set.draw do + resources :threads, :has_many => { :messages => [ :comments, { :authors => :threads } ] } end assert_simply_restful_for :threads @@ -570,8 +535,8 @@ class ResourcesTest < ActionController::TestCase def test_shallow_resource_has_many_should_become_shallow_nested_resources with_routing do |set| - set.draw do |map| - map.resources :messages, :has_many => [ :comments, :authors ], :shallow => true + set.draw do + resources :messages, :has_many => [ :comments, :authors ], :shallow => true end assert_simply_restful_for :messages, :shallow => true @@ -582,8 +547,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_one_should_become_nested_resources with_routing do |set| - set.draw do |map| - map.resources :messages, :has_one => :logo + set.draw do + resources :messages, :has_one => :logo end assert_simply_restful_for :messages @@ -593,8 +558,8 @@ class ResourcesTest < ActionController::TestCase def test_shallow_resource_has_one_should_become_shallow_nested_resources with_routing do |set| - set.draw do |map| - map.resources :messages, :has_one => :logo, :shallow => true + set.draw do + resources :messages, :has_one => :logo, :shallow => true end assert_simply_restful_for :messages, :shallow => true @@ -638,9 +603,9 @@ class ResourcesTest < ActionController::TestCase def test_should_nest_resources_in_singleton_resource with_routing do |set| - set.draw do |map| - map.resource :account do |account| - account.resources :messages + set.draw do + resource :account do + resources :messages end end @@ -651,9 +616,9 @@ class ResourcesTest < ActionController::TestCase def test_should_nest_resources_in_singleton_resource_with_path_prefix with_routing do |set| - set.draw do |map| - map.resource(:account, :path_prefix => ':site_id') do |account| - account.resources :messages + set.draw do + resource(:account, :path_prefix => ':site_id') do + resources :messages end end @@ -664,9 +629,9 @@ class ResourcesTest < ActionController::TestCase def test_should_nest_singleton_resource_in_resources with_routing do |set| - set.draw do |map| - map.resources :threads do |thread| - thread.resource :admin, :controller => 'admin' + set.draw do + resources :threads do + resource :admin, :controller => 'admin' end end @@ -694,8 +659,8 @@ class ResourcesTest < ActionController::TestCase def test_should_not_allow_invalid_head_method_for_member_routes with_routing do |set| assert_raise(ArgumentError) do - set.draw do |map| - map.resources :messages, :member => {:something => :head} + set.draw do + resources :messages, :member => {:something => :head} end end end @@ -704,8 +669,8 @@ class ResourcesTest < ActionController::TestCase def test_should_not_allow_invalid_http_methods_for_member_routes with_routing do |set| assert_raise(ArgumentError) do - set.draw do |map| - map.resources :messages, :member => {:something => :invalid} + set.draw do + resources :messages, :member => {:something => :invalid} end end end @@ -713,9 +678,9 @@ class ResourcesTest < ActionController::TestCase def test_resource_action_separator with_routing do |set| - set.draw do |map| - map.resources :messages, :collection => {:search => :get}, :new => {:preview => :any}, :name_prefix => 'thread_', :path_prefix => '/threads/:thread_id' - map.resource :account, :member => {:login => :get}, :new => {:preview => :any}, :name_prefix => 'admin_', :path_prefix => '/admin' + set.draw do + resources :messages, :collection => {:search => :get}, :new => {:preview => :any}, :name_prefix => 'thread_', :path_prefix => '/threads/:thread_id' + resource :account, :member => {:login => :get}, :new => {:preview => :any}, :name_prefix => 'admin_', :path_prefix => '/admin' end action_separator = ActionController::Base.resource_action_separator @@ -733,8 +698,8 @@ class ResourcesTest < ActionController::TestCase def test_new_style_named_routes_for_resource with_routing do |set| - set.draw do |map| - map.resources :messages, :collection => {:search => :get}, :new => {:preview => :any}, :name_prefix => 'thread_', :path_prefix => '/threads/:thread_id' + set.draw do + resources :messages, :collection => {:search => :get}, :new => {:preview => :any}, :name_prefix => 'thread_', :path_prefix => '/threads/:thread_id' end assert_simply_restful_for :messages, :name_prefix => 'thread_', :path_prefix => 'threads/1/', :options => { :thread_id => '1' } assert_named_route "/threads/1/messages/search", "search_thread_messages_path", {} @@ -745,8 +710,8 @@ class ResourcesTest < ActionController::TestCase def test_new_style_named_routes_for_singleton_resource with_routing do |set| - set.draw do |map| - map.resource :account, :member => {:login => :get}, :new => {:preview => :any}, :name_prefix => 'admin_', :path_prefix => '/admin' + set.draw do + resource :account, :member => {:login => :get}, :new => {:preview => :any}, :name_prefix => 'admin_', :path_prefix => '/admin' end assert_singleton_restful_for :account, :name_prefix => 'admin_', :path_prefix => 'admin/' assert_named_route "/admin/account/login", "login_admin_account_path", {} @@ -757,9 +722,9 @@ class ResourcesTest < ActionController::TestCase def test_resources_in_namespace with_routing do |set| - set.draw do |map| - map.namespace :backoffice do |backoffice| - backoffice.resources :products + set.draw do + namespace :backoffice do + resources :products end end @@ -769,9 +734,9 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_many_in_namespace with_routing do |set| - set.draw do |map| - map.namespace :backoffice do |backoffice| - backoffice.resources :products, :has_many => :tags + set.draw do + namespace :backoffice do + resources :products, :has_many => :tags end end @@ -782,9 +747,9 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_one_in_namespace with_routing do |set| - set.draw do |map| - map.namespace :backoffice do |backoffice| - backoffice.resources :products, :has_one => :manufacturer + set.draw do + namespace :backoffice do + resources :products, :has_one => :manufacturer end end @@ -795,10 +760,10 @@ class ResourcesTest < ActionController::TestCase def test_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 + set.draw do + namespace :backoffice do + backoffice.namespace :admin do + resources :products end end end @@ -809,8 +774,8 @@ class ResourcesTest < ActionController::TestCase def test_resources_using_namespace with_routing do |set| - set.draw do |map| - map.resources :products, :namespace => "backoffice/" + set.draw do + resources :products, :namespace => "backoffice/" end assert_simply_restful_for :products, :controller => "backoffice/products" @@ -819,9 +784,9 @@ class ResourcesTest < ActionController::TestCase def test_nested_resources_using_namespace with_routing do |set| - set.draw do |map| - map.namespace :backoffice do |backoffice| - backoffice.resources :products do |products| + set.draw do + namespace :backoffice do + resources :products do products.resources :images end end @@ -833,10 +798,10 @@ class ResourcesTest < ActionController::TestCase 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| + set.draw do + namespace :backoffice do + backoffice.namespace :admin do + resources :products do products.resources :images end end @@ -863,12 +828,12 @@ class ResourcesTest < ActionController::TestCase def test_multiple_with_path_segment_and_controller with_routing do |set| - set.draw do |map| - map.resources :products do |products| + set.draw do + resources :products do products.resources :product_reviews, :as => 'reviews', :controller => 'messages' end - map.resources :tutors do |tutors| - tutors.resources :tutor_reviews, :as => 'reviews', :controller => 'comments' + resources :tutors do + resources :tutor_reviews, :as => 'reviews', :controller => 'comments' end end @@ -877,17 +842,22 @@ class ResourcesTest < ActionController::TestCase end end - def test_with_path_segment_path_prefix_requirements + def test_with_path_segment_path_prefix_constraints expected_options = {:controller => 'messages', :action => 'show', :thread_id => '1.1.1', :id => '1'} - with_restful_routing :messages, :as => 'comments',:path_prefix => '/thread/:thread_id', :requirements => { :thread_id => /[0-9]\.[0-9]\.[0-9]/ } do + with_routing do |set| + set.draw do + scope '/thread/:thread_id', :constraints => { :thread_id => /[0-9]\.[0-9]\.[0-9]/ } do + resources :messages, :as => 'comments' + end + end assert_recognizes(expected_options, :path => 'thread/1.1.1/comments/1', :method => :get) end end def test_resource_has_only_show_action with_routing do |set| - set.draw do |map| - map.resources :products, :only => :show + set.draw do + resources :products, :only => :show end assert_resource_allowed_routes('products', {}, { :id => '1' }, :show, [:index, :new, :create, :edit, :update, :destroy]) @@ -897,8 +867,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_has_only_show_action with_routing do |set| - set.draw do |map| - map.resource :account, :only => :show + set.draw do + resource :account, :only => :show end assert_singleton_resource_allowed_routes('accounts', {}, :show, [:index, :new, :create, :edit, :update, :destroy]) @@ -908,8 +878,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_does_not_have_destroy_action with_routing do |set| - set.draw do |map| - map.resources :products, :except => :destroy + set.draw do + resources :products, :except => :destroy end assert_resource_allowed_routes('products', {}, { :id => '1' }, [:index, :new, :create, :show, :edit, :update], :destroy) @@ -919,8 +889,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_does_not_have_destroy_action with_routing do |set| - set.draw do |map| - map.resource :account, :except => :destroy + set.draw do + resource :account, :except => :destroy end assert_singleton_resource_allowed_routes('accounts', {}, [:new, :create, :show, :edit, :update], :destroy) @@ -930,8 +900,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_only_create_action_and_named_route with_routing do |set| - set.draw do |map| - map.resources :products, :only => :create + set.draw do + resources :products, :only => :create end assert_resource_allowed_routes('products', {}, { :id => '1' }, :create, [:index, :new, :show, :edit, :update, :destroy]) @@ -943,8 +913,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_only_update_action_and_named_route with_routing do |set| - set.draw do |map| - map.resources :products, :only => :update + set.draw do + resources :products, :only => :update end assert_resource_allowed_routes('products', {}, { :id => '1' }, :update, [:index, :new, :create, :show, :edit, :destroy]) @@ -956,8 +926,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_only_destroy_action_and_named_route with_routing do |set| - set.draw do |map| - map.resources :products, :only => :destroy + set.draw do + resources :products, :only => :destroy end assert_resource_allowed_routes('products', {}, { :id => '1' }, :destroy, [:index, :new, :create, :show, :edit, :update]) @@ -969,8 +939,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_has_only_create_action_and_named_route with_routing do |set| - set.draw do |map| - map.resource :account, :only => :create + set.draw do + resource :account, :only => :create end assert_singleton_resource_allowed_routes('accounts', {}, :create, [:new, :show, :edit, :update, :destroy]) @@ -982,8 +952,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_has_only_update_action_and_named_route with_routing do |set| - set.draw do |map| - map.resource :account, :only => :update + set.draw do + resource :account, :only => :update end assert_singleton_resource_allowed_routes('accounts', {}, :update, [:new, :create, :show, :edit, :destroy]) @@ -995,8 +965,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_has_only_destroy_action_and_named_route with_routing do |set| - set.draw do |map| - map.resource :account, :only => :destroy + set.draw do + resource :account, :only => :destroy end assert_singleton_resource_allowed_routes('accounts', {}, :destroy, [:new, :create, :show, :edit, :update]) @@ -1008,8 +978,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_only_collection_action with_routing do |set| - set.draw do |map| - map.resources :products, :except => :all, :collection => { :sale => :get } + set.draw do + resources :products, :except => :all, :collection => { :sale => :get } end assert_resource_allowed_routes('products', {}, { :id => '1' }, [], [:index, :new, :create, :show, :edit, :update, :destroy]) @@ -1022,8 +992,8 @@ class ResourcesTest < ActionController::TestCase def test_resource_has_only_member_action with_routing do |set| - set.draw do |map| - map.resources :products, :except => :all, :member => { :preview => :get } + set.draw do + resources :products, :except => :all, :member => { :preview => :get } end assert_resource_allowed_routes('products', {}, { :id => '1' }, [], [:index, :new, :create, :show, :edit, :update, :destroy]) @@ -1036,8 +1006,8 @@ class ResourcesTest < ActionController::TestCase def test_singleton_resource_has_only_member_action with_routing do |set| - set.draw do |map| - map.resource :account, :except => :all, :member => { :signup => :get } + set.draw do + resource :account, :except => :all, :member => { :signup => :get } end assert_singleton_resource_allowed_routes('accounts', {}, [], [:new, :create, :show, :edit, :update, :destroy]) @@ -1050,9 +1020,9 @@ class ResourcesTest < ActionController::TestCase def test_nested_resource_has_only_show_and_member_action with_routing do |set| - set.draw do |map| - map.resources :products, :only => [:index, :show] do |product| - product.resources :images, :member => { :thumbnail => :get }, :only => :show + set.draw do + resources :products, :only => [:index, :show] do + resources :images, :member => { :thumbnail => :get }, :only => :show end end @@ -1066,9 +1036,9 @@ class ResourcesTest < ActionController::TestCase def test_nested_resource_does_not_inherit_only_option with_routing do |set| - set.draw do |map| - map.resources :products, :only => :show do |product| - product.resources :images, :except => :destroy + set.draw do + resources :products, :only => :show do + resources :images, :except => :destroy end end @@ -1079,9 +1049,9 @@ class ResourcesTest < ActionController::TestCase 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 + set.draw do + resources :products, :only => :show do + resources :images end end @@ -1092,9 +1062,9 @@ class ResourcesTest < ActionController::TestCase def test_nested_resource_does_not_inherit_except_option with_routing do |set| - set.draw do |map| - map.resources :products, :except => :show do |product| - product.resources :images, :only => :destroy + set.draw do + resources :products, :except => :show do + resources :images, :only => :destroy end end @@ -1105,9 +1075,9 @@ class ResourcesTest < ActionController::TestCase 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 + set.draw do + resources :products, :except => :show do + resources :images end end @@ -1118,8 +1088,8 @@ class ResourcesTest < ActionController::TestCase def test_default_singleton_restful_route_uses_get with_routing do |set| - set.draw do |map| - map.resource :product + set.draw do + resource :product end assert_routing '/product', :controller => 'products', :action => 'show' @@ -1135,15 +1105,41 @@ class ResourcesTest < ActionController::TestCase protected def with_restful_routing(*args) + options = args.extract_options! + collection_methods = options.delete(:collection) + member_methods = options.delete(:member) + path_prefix = options.delete(:path_prefix) + args.push(options) + with_routing do |set| - set.draw { |map| map.resources(*args) } + set.draw do + scope(path_prefix || '') do + resources(*args) do + if collection_methods + collection do + collection_methods.each do |name, method| + send(method, name) + end + end + end + + if member_methods + member do + member_methods.each do |name, method| + send(method, name) + end + end + end + end + end + end yield end end def with_singleton_resources(*args) with_routing do |set| - set.draw { |map| map.resource(*args) } + set.draw {resource(*args) } yield end end @@ -1385,7 +1381,7 @@ class ResourcesTest < ActionController::TestCase end def distinct_routes? (r1, r2) - if r1.conditions == r2.conditions and r1.requirements == r2.requirements then + if r1.conditions == r2.conditions and r1.constraints == r2.constraints then if r1.segments.collect(&:to_s) == r2.segments.collect(&:to_s) then return false end |