aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-03-31 07:47:58 -0700
committerXavier Noria <fxn@hashref.com>2010-03-31 07:47:58 -0700
commit824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8 (patch)
tree1967c2a945d6e131d467fb4f0178a0f60e01ae8a /activerecord/test/cases/associations/has_many_associations_test.rb
parent1ed1652bef981d9402797b6cb9f0920a40eea21a (diff)
parentdb28d407f76a790a31e27bf51560e23425dd6944 (diff)
downloadrails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.gz
rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.tar.bz2
rails-824fa10f4d1306cc1e310a7d5de7e95cfb07d6f8.zip
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb8
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