aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorBob Aman <bob@sporkmonger.com>2009-01-28 20:56:02 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-01-28 20:56:46 +0000
commit166c63818e901e64786a76029febf7c9cdb40f2d (patch)
treef0398c5cfea0d55f32a5f3136d09fa428d1a2140 /activeresource/test
parent91eeb0ff119d34d0fcdb44d3d7fcbb7924208e05 (diff)
downloadrails-166c63818e901e64786a76029febf7c9cdb40f2d.tar.gz
rails-166c63818e901e64786a76029febf7c9cdb40f2d.tar.bz2
rails-166c63818e901e64786a76029febf7c9cdb40f2d.zip
Improve exception handling when Location header is invalid. [#1192 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/base_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb
index d37a6d4ed2..e22388f4a7 100644
--- a/activeresource/test/base_test.rb
+++ b/activeresource/test/base_test.rb
@@ -627,6 +627,12 @@ class BaseTest < Test::Unit::TestCase
assert_equal '1', p.__send__(:id_from_response, resp)
end
+ def test_id_from_response_without_location
+ p = Person.new
+ resp = {}
+ assert_equal nil, p.__send__(:id_from_response, resp)
+ end
+
def test_create_with_custom_prefix
matzs_house = StreetAddress.new(:person_id => 1)
matzs_house.save
@@ -670,7 +676,6 @@ class BaseTest < Test::Unit::TestCase
assert_equal person, person.reload
end
-
def test_create
rick = Person.create(:name => 'Rick')
assert rick.valid?
@@ -687,6 +692,14 @@ class BaseTest < Test::Unit::TestCase
assert_raises(ActiveResource::ResourceConflict) { Person.create(:name => 'Rick') }
end
+ def test_create_without_location
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.post "/people.xml", {}, nil, 201
+ end
+ person = Person.create(:name => 'Rick')
+ assert_equal nil, person.id
+ end
+
def test_clone
matz = Person.find(1)
matz_c = matz.clone