mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add routing tests to assert that RoutingError is raised when conditions aren't met. Closes #6016 [Nathan Witmer]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4907 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c1c659a2de
commit
2b45e2d370
2 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*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]
|
* Deprecation: update docs. #5998 [jakob@mentalized.net, Kevin Clark]
|
||||||
|
|
||||||
* Make auto_link parse a greater subset of valid url formats. [Jamis Buck]
|
* Make auto_link parse a greater subset of valid url formats. [Jamis Buck]
|
||||||
|
|
|
@ -1381,6 +1381,13 @@ class RouteSetTest < Test::Unit::TestCase
|
||||||
request.method = :post
|
request.method = :post
|
||||||
assert_nothing_raised { set.recognize(request) }
|
assert_nothing_raised { set.recognize(request) }
|
||||||
assert_equal("create", request.path_parameters[:action])
|
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.path = "/people/5"
|
||||||
request.method = :get
|
request.method = :get
|
||||||
|
@ -1397,6 +1404,10 @@ class RouteSetTest < Test::Unit::TestCase
|
||||||
assert_nothing_raised { set.recognize(request) }
|
assert_nothing_raised { set.recognize(request) }
|
||||||
assert_equal("destroy", request.path_parameters[:action])
|
assert_equal("destroy", request.path_parameters[:action])
|
||||||
assert_equal("5", request.path_parameters[:id])
|
assert_equal("5", request.path_parameters[:id])
|
||||||
|
|
||||||
|
request.method = :post
|
||||||
|
assert_raises(ActionController::RoutingError) { set.recognize(request) }
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
Object.send(:remove_const, :PeopleController)
|
Object.send(:remove_const, :PeopleController)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue