diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-01 03:20:38 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-01 03:20:38 +0100 |
commit | 8c5fe60ec82986ab4aa337a69c2ab753f518976d (patch) | |
tree | 13ac7474bd3da7b26d7aef896bf98951bffdeeee /activerecord/test/cases/base_test.rb | |
parent | 50fbb7405665ba1c2b7c6f23574053a4764cef7f (diff) | |
download | rails-8c5fe60ec82986ab4aa337a69c2ab753f518976d.tar.gz rails-8c5fe60ec82986ab4aa337a69c2ab753f518976d.tar.bz2 rails-8c5fe60ec82986ab4aa337a69c2ab753f518976d.zip |
Simplify repair_validations on AR and make it work with new callbacks.
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index ebb717812d..730d9d8df7 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -201,7 +201,7 @@ class BasicsTest < ActiveRecord::TestCase topic = Topic.new(:title => "New Topic") assert topic.save! - reply = Reply.new + reply = WrongReply.new assert_raise(ActiveRecord::RecordInvalid) { reply.save! } end @@ -959,6 +959,7 @@ class BasicsTest < ActiveRecord::TestCase end def test_update_attributes! + Reply.validates_presence_of(:title) reply = Reply.find(2) assert_equal "The Second Topic of the day", reply.title assert_equal "Have a nice day", reply.content @@ -974,6 +975,8 @@ class BasicsTest < ActiveRecord::TestCase assert_equal "Have a nice day", reply.content assert_raise(ActiveRecord::RecordInvalid) { reply.update_attributes!(:title => nil, :content => "Have a nice evening") } + ensure + Reply.reset_callbacks(:validate) end def test_mass_assignment_should_raise_exception_if_accessible_and_protected_attribute_writers_are_both_used |