aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-02-09 22:21:55 +0000
committerMichael Koziarski <michael@koziarski.com>2008-02-09 22:21:55 +0000
commit5396b0f3b0c2f6a2afc4ab1af114123bc410cc4d (patch)
treee6b9d665528f28830f139881ebb4119f11a0a9f6 /activeresource/test
parent9e13b966f6fa19b19c34abfe29400b6f826e00c7 (diff)
downloadrails-5396b0f3b0c2f6a2afc4ab1af114123bc410cc4d.tar.gz
rails-5396b0f3b0c2f6a2afc4ab1af114123bc410cc4d.tar.bz2
rails-5396b0f3b0c2f6a2afc4ab1af114123bc410cc4d.zip
Use HEAD instead of GET inside exists? Closes #11062 [bscofield]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8827 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/base_test.rb5
-rw-r--r--activeresource/test/connection_test.rb7
2 files changed, 12 insertions, 0 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb
index 3808209f79..7606c56bcf 100644
--- a/activeresource/test/base_test.rb
+++ b/activeresource/test/base_test.rb
@@ -36,6 +36,11 @@ class BaseTest < Test::Unit::TestCase
mock.put "/people//addresses/1.xml", {}, nil, 404
mock.delete "/people//addresses/1.xml", {}, nil, 404
mock.post "/people//addresses.xml", {}, nil, 404
+ mock.head "/people/1.xml", {}, nil, 200
+ mock.head "/people/99.xml", {}, nil, 404
+ mock.head "/people/1/addresses/1.xml", {}, nil, 200
+ mock.head "/people/1/addresses/2.xml", {}, nil, 404
+ mock.head "/people/2/addresses/1.xml", {}, nil, 404
end
end
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb
index 8ffc4dfbb2..38fdbd3b2f 100644
--- a/activeresource/test/connection_test.rb
+++ b/activeresource/test/connection_test.rb
@@ -27,6 +27,7 @@ class ConnectionTest < Test::Unit::TestCase
mock.delete "/people/2.xml", @header, nil, 200
mock.post "/people.xml", {}, nil, 201, 'Location' => '/people/5.xml'
mock.post "/members.xml", {}, @header, 201, 'Location' => '/people/6.xml'
+ mock.head "/people/1.xml", {}, nil, 200
end
end
@@ -105,6 +106,12 @@ class ConnectionTest < Test::Unit::TestCase
assert_equal "Matz", matz["name"]
end
+ def test_head
+ response = @conn.head("/people/1.xml")
+ assert response.body.blank?
+ assert_equal 200, response.code
+ end
+
def test_get_with_header
david = @conn.get("/people/2.xml", @header)
assert_equal "David", david["name"]