aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/test/base_test.rb')
-rw-r--r--activeresource/test/base_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb
index cba675177a..9c236bc893 100644
--- a/activeresource/test/base_test.rb
+++ b/activeresource/test/base_test.rb
@@ -899,6 +899,14 @@ class BaseTest < Test::Unit::TestCase
assert_raise(ActiveResource::ResourceNotFound) { StreetAddress.find(1, :params => { :person_id => 1 }) }
end
+ def test_destroy_with_410_gone
+ assert Person.find(1).destroy
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.get "/people/1.xml", {}, nil, 410
+ end
+ assert_raise(ActiveResource::ResourceGone) { Person.find(1).destroy }
+ end
+
def test_delete
assert Person.delete(1)
ActiveResource::HttpMock.respond_to do |mock|
@@ -914,6 +922,14 @@ class BaseTest < Test::Unit::TestCase
end
assert_raise(ActiveResource::ResourceNotFound) { StreetAddress.find(1, :params => { :person_id => 1 }) }
end
+
+ def test_delete_with_410_gone
+ assert Person.delete(1)
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.get "/people/1.xml", {}, nil, 410
+ end
+ assert_raise(ActiveResource::ResourceGone) { Person.find(1) }
+ end
def test_exists
# Class method.
@@ -974,6 +990,14 @@ class BaseTest < Test::Unit::TestCase
assert Person.exists?('not-mocked')
end
+ def test_exists_with_410_gone
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.head "/people/1.xml", {}, nil, 410
+ end
+
+ assert !Person.exists?(1)
+ end
+
def test_to_xml
matz = Person.find(1)
xml = matz.encode