diff options
author | Jamis Buck <jamis@37signals.com> | 2006-10-02 22:14:15 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-10-02 22:14:15 +0000 |
commit | 628838ed9349252eccd86b531959c111e285893e (patch) | |
tree | 2a7960e22b381eddf691dacc96cd18925de64dc8 /activeresource/test | |
parent | 48d4d43f9236f705e2e81bc1781c8c37384886a9 (diff) | |
download | rails-628838ed9349252eccd86b531959c111e285893e.tar.gz rails-628838ed9349252eccd86b531959c111e285893e.tar.bz2 rails-628838ed9349252eccd86b531959c111e285893e.zip |
Make #save behavior mimic AR::Base#save (true on success, false on failure)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/base_errors_test.rb | 7 | ||||
-rw-r--r-- | activeresource/test/base_test.rb | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/activeresource/test/base_errors_test.rb b/activeresource/test/base_errors_test.rb index 1aa677b1ba..c6b840ebe1 100644 --- a/activeresource/test/base_errors_test.rb +++ b/activeresource/test/base_errors_test.rb @@ -6,11 +6,8 @@ class BaseErrorsTest < Test::Unit::TestCase ActiveResource::HttpMock.respond_to do |mock| mock.post "/people.xml", {}, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><errors><error>Age can't be blank</error><error>Name can't be blank</error><error>Name must start with a letter</error><error>Person quota full for today.</error></errors>", 400 end - @exception = nil - @person = Person.new(:name => '', :age => '') - @person.save - rescue ActiveResource::ResourceInvalid - @exception = $! + @person = Person.new(:name => '', :age => '') + assert_equal @person.save, false end def test_should_mark_as_invalid diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index f3fd3b43e2..dd017b71fa 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -109,7 +109,7 @@ class BaseTest < Test::Unit::TestCase def test_create rick = Person.new - rick.save + assert_equal true, rick.save assert_equal '5', rick.id end @@ -133,7 +133,7 @@ class BaseTest < Test::Unit::TestCase matz.name = "David" assert_kind_of Person, matz assert_equal "David", matz.name - matz.save + assert_equal true, matz.save end def test_update_with_custom_prefix |