aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/resources_test.rb
diff options
context:
space:
mode:
authorTom Ward <tom@popdog.net>2008-07-18 20:19:03 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-18 20:19:03 -0500
commitd39485078ec56e25a96e97d44b53498d8a1c7426 (patch)
tree6c7a23d8c91536a8e79d38372d710baffc42c8d2 /actionpack/test/controller/resources_test.rb
parentc3d1fda555c4bd5f8821d830c685ae5d0e7e52d0 (diff)
downloadrails-d39485078ec56e25a96e97d44b53498d8a1c7426.tar.gz
rails-d39485078ec56e25a96e97d44b53498d8a1c7426.tar.bz2
rails-d39485078ec56e25a96e97d44b53498d8a1c7426.zip
Raise ArgumentError if an invalid method is specified as part of a route's conditions. Also raise an error if HEAD is specified as the method, as rails routes all HEAD requests through the equivalent GET, though doesn't return the response body [#182 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test/controller/resources_test.rb')
-rw-r--r--actionpack/test/controller/resources_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 0f7924649a..e153b0cc98 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -516,6 +516,26 @@ class ResourcesTest < Test::Unit::TestCase
end
end
+ def test_should_not_allow_invalid_head_method_for_member_routes
+ with_routing do |set|
+ set.draw do |map|
+ assert_raises(ArgumentError) do
+ map.resources :messages, :member => {:something => :head}
+ end
+ end
+ end
+ end
+
+ def test_should_not_allow_invalid_http_methods_for_member_routes
+ with_routing do |set|
+ set.draw do |map|
+ assert_raises(ArgumentError) do
+ map.resources :messages, :member => {:something => :invalid}
+ end
+ end
+ end
+ end
+
def test_resource_action_separator
with_routing do |set|
set.draw do |map|