Permalink
Browse files

Add routing tests to assert that RoutingError is raised when conditio…

…ns aren't met. Closes #6016 [Nathan Witmer]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4907 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent c1c659a commit 2b45e2d37093bd035085bddf0f3fa37192a25b5a @technoweenie technoweenie committed Sep 2, 2006
Showing with 13 additions and 0 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +11 −0 actionpack/test/controller/routing_test.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Add routing tests to assert that RoutingError is raised when conditions aren't met. Closes #6016 [Nathan Witmer]
+
* Deprecation: update docs. #5998 [jakob@mentalized.net, Kevin Clark]
* Make auto_link parse a greater subset of valid url formats. [Jamis Buck]
@@ -1381,6 +1381,13 @@ def test_recognize_with_conditions
request.method = :post
assert_nothing_raised { set.recognize(request) }
assert_equal("create", request.path_parameters[:action])
+
+ request.method = :put
+ assert_nothing_raised { set.recognize(request) }
+ assert_equal("update", request.path_parameters[:action])
+
+ request.method = :update
+ assert_raises(ActionController::RoutingError) { set.recognize(request) }
request.path = "/people/5"
request.method = :get
@@ -1397,6 +1404,10 @@ def test_recognize_with_conditions
assert_nothing_raised { set.recognize(request) }
assert_equal("destroy", request.path_parameters[:action])
assert_equal("5", request.path_parameters[:id])
+
+ request.method = :post
+ assert_raises(ActionController::RoutingError) { set.recognize(request) }
+
ensure
Object.send(:remove_const, :PeopleController)
end

0 comments on commit 2b45e2d

Please sign in to comment.