From f46486d37ebe1d2d7354cf46dd024690a6d25c9a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 18 Apr 2005 19:19:23 +0000 Subject: Added Base.save! that attempts to save the record just like Base.save but will raise a InvalidRecord exception instead of returning false if the record is not valid [After much pestering from Dave Thomas] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/validations_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 736cad140a..a661193a98 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -64,6 +64,11 @@ class ValidationsTest < Test::Unit::TestCase assert_equal "is Wrong Update", r.errors.on("title"), "A reply with a bad content should contain an error" end + def test_invalid_record_exception + r = Reply.new + assert_raises(ActiveRecord::InvalidRecord) { r.save! } + end + def test_single_error_per_attr_iteration r = Reply.new r.save -- cgit v1.2.3