diff options
Diffstat (limited to 'activerecord/test/cases/associations/has_one_associations_test.rb')
-rwxr-xr-x | activerecord/test/cases/associations/has_one_associations_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index abc7ee7e9d..d3ca0cae41 100755 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -275,6 +275,18 @@ class HasOneAssociationsTest < ActiveRecord::TestCase assert_equal "is invalid", firm.errors.on("account") end + + def test_save_succeeds_for_invalid_has_one_with_validate_false + firm = Firm.find(:first) + assert firm.valid? + + firm.unvalidated_account = Account.new + + assert !firm.unvalidated_account.valid? + assert firm.valid? + assert firm.save + end + def test_assignment_before_either_saved firm = Firm.new("name" => "GlobalMegaCorp") firm.account = a = Account.new("credit_limit" => 1000) |