aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-09-26 22:45:09 +0000
committerJamis Buck <jamis@37signals.com>2006-09-26 22:45:09 +0000
commit6a8dcc8a5bd9e8510c75d7a88a1072d88067aaa9 (patch)
tree571f37e07c22168f9cec2407432c199728a5bbd4 /actionpack/test/controller
parenta0bf0195a5c27c8c8493b1a44987154a9dc0d526 (diff)
downloadrails-6a8dcc8a5bd9e8510c75d7a88a1072d88067aaa9.tar.gz
rails-6a8dcc8a5bd9e8510c75d7a88a1072d88067aaa9.tar.bz2
rails-6a8dcc8a5bd9e8510c75d7a88a1072d88067aaa9.zip
Make sure map.resources(:things, :new => { :new => :any }) correctly sets /things/new to be accessible by any method rather than creating another resource at /things/new;new
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5195 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/resources_test.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index b2ee7823c9..32b554604d 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -17,11 +17,11 @@ class ResourcesTest < Test::Unit::TestCase
: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 [:preview, :draft], resource, :new, :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_default_restful_routes
@@ -122,6 +122,24 @@ class ResourcesTest < Test::Unit::TestCase
end
end
+ def test_override_new_method
+ with_restful_routing :messages do
+ assert_restful_routes_for :messages do |options|
+ assert_recognizes(options.merge(:action => "new"), :path => "/messages/new", :method => :get)
+ assert_raises(ActionController::RoutingError) do
+ ActionController::Routing::Routes.recognize_path("/messages/new", :method => :post)
+ end
+ end
+ end
+
+ with_restful_routing :messages, :new => { :new => :any } do
+ assert_restful_routes_for :messages do |options|
+ assert_recognizes(options.merge(:action => "new"), :path => "/messages/new", :method => :post)
+ assert_recognizes(options.merge(:action => "new"), :path => "/messages/new", :method => :get)
+ end
+ end
+ end
+
def test_nested_restful_routes
with_routing do |set|
set.draw do |map|