diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-14 23:09:46 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-14 23:09:46 +0000 |
commit | 1ceccdeb7f86898a9e511e934ea6b0863d30590d (patch) | |
tree | 51df80c22b0ea40c7893e259884be2204339669e /activeresource/test | |
parent | f5c17790e1a16d92d29f60a5b308b3895e5b94c5 (diff) | |
download | rails-1ceccdeb7f86898a9e511e934ea6b0863d30590d.tar.gz rails-1ceccdeb7f86898a9e511e934ea6b0863d30590d.tar.bz2 rails-1ceccdeb7f86898a9e511e934ea6b0863d30590d.zip |
Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) (closes #10326) [trek]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8390 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/connection_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb index 09e80f95c1..ffad974401 100644 --- a/activeresource/test/connection_test.rb +++ b/activeresource/test/connection_test.rb @@ -38,6 +38,15 @@ class ConnectionTest < Test::Unit::TestCase assert_equal expected, handle_response(expected) end + # 400 is a bad request (e.g. malformed URI or missing request parameter) + assert_response_raises ActiveResource::BadRequest, 400 + + # 401 is an unauthorized request + assert_response_raises ActiveResource::UnauthorizedAccess, 401 + + # 403 is a forbidden requst (and authorizing will not help) + assert_response_raises ActiveResource::ForbiddenAccess, 403 + # 404 is a missing resource. assert_response_raises ActiveResource::ResourceNotFound, 404 @@ -51,7 +60,7 @@ class ConnectionTest < Test::Unit::TestCase assert_response_raises ActiveResource::ResourceInvalid, 422 # 4xx are client errors. - [401, 499].each do |code| + [402, 499].each do |code| assert_response_raises ActiveResource::ClientError, code end |