Skip to content

Commit

Permalink
Add routing tests to assert that RoutingError is raised when conditio…
Browse files Browse the repository at this point in the history
…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
technoweenie committed Sep 2, 2006
1 parent c1c659a commit 2b45e2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -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]
Expand Down
11 changes: 11 additions & 0 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2b45e2d

Please sign in to comment.