diff options
Diffstat (limited to 'activeresource/test/base_test.rb')
-rw-r--r-- | activeresource/test/base_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index 040bd02b52..4d3bb7461e 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -196,7 +196,7 @@ class BaseTest < Test::Unit::TestCase assert_raises(ActiveResource::ResourceNotFound) { StreetAddress.find(1) } end - def test_create + def test_save rick = Person.new assert_equal true, rick.save assert_equal '5', rick.id @@ -217,6 +217,19 @@ class BaseTest < Test::Unit::TestCase assert_equal '5', matzs_house.id end + def test_create + rick = Person.create(:name => 'Rick') + assert rick.valid? + assert !rick.new? + assert_equal '5', rick.id + + # Test that save exceptions get bubbled up too + ActiveResource::HttpMock.respond_to do |mock| + mock.post "/people.xml", {}, nil, 409 + end + assert_raises(ActiveResource::ResourceConflict) { Person.create(:name => 'Rick') } + end + def test_update matz = Person.find(:first) matz.name = "David" |