aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/connection_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/test/connection_test.rb')
-rw-r--r--activeresource/test/connection_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb
index 67d5553e72..13b518d782 100644
--- a/activeresource/test/connection_test.rb
+++ b/activeresource/test/connection_test.rb
@@ -41,6 +41,9 @@ class ConnectionTest < Test::Unit::TestCase
# 404 is a missing resource.
assert_response_raises ActiveResource::ResourceNotFound, 404
+ # 405 is a missing not allowed error
+ assert_response_raises ActiveResource::MethodNotAllowed, 405
+
# 409 is an optimistic locking error
assert_response_raises ActiveResource::ResourceConflict, 409
@@ -63,6 +66,16 @@ class ConnectionTest < Test::Unit::TestCase
end
end
+ ResponseHeaderStub = Struct.new(:code, 'Allow')
+ def test_should_return_allowed_methods_for_method_no_allowed_exception
+ begin
+ handle_response ResponseHeaderStub.new(405, "GET, POST")
+ rescue ActiveResource::MethodNotAllowed => e
+ assert_equal "Failed with 405", e.message
+ assert_equal [:get, :post], e.allowed_methods
+ end
+ end
+
def test_initialize_raises_argument_error_on_missing_site
assert_raise(ArgumentError) { ActiveResource::Connection.new(nil) }
end