aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_one_associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/associations/has_one_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index 7372f2da1b..8f5540950e 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -177,7 +177,15 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
assert_nothing_raised { firm.destroy }
end
- def test_succesful_build_association
+ def test_dependence_with_restrict
+ firm = RestrictedFirm.new(:name => 'restrict')
+ firm.save!
+ account = firm.create_account(:credit_limit => 10)
+ assert !firm.account.nil?
+ assert_raise(ActiveRecord::DeleteRestrictionError) { firm.destroy }
+ end
+
+ def test_successful_build_association
firm = Firm.new("name" => "GlobalMegaCorp")
firm.save