diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-03-28 18:47:46 +0430 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2010-03-28 18:47:46 +0430 |
commit | f1e5a9ff982998c31c9dedf2fa79180c7dea820a (patch) | |
tree | 38857ed6fbf9cbd1ed21da13f0946b091ed516f6 /activerecord/test/cases/associations/has_many_associations_test.rb | |
parent | 76f024ac8db82490a99c71d0d8951d677e3bc9bc (diff) | |
download | rails-f1e5a9ff982998c31c9dedf2fa79180c7dea820a.tar.gz rails-f1e5a9ff982998c31c9dedf2fa79180c7dea820a.tar.bz2 rails-f1e5a9ff982998c31c9dedf2fa79180c7dea820a.zip |
Add :dependent = to has_one and has_many [#3075 state:resolved]
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 54624e79ce..c1e539d573 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -836,6 +836,14 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal num_accounts, Account.count end + def test_restrict + firm = RestrictedFirm.new(:name => 'restrict') + firm.save! + child_firm = firm.companies.create(:name => 'child') + assert !firm.companies.empty? + assert_raise(ActiveRecord::DeleteRestrictionError) { firm.destroy } + end + def test_included_in_collection assert companies(:first_firm).clients.include?(Client.find(2)) end |