aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-04-04 01:01:40 +0100
committerJeremy Kemper <jeremy@bitsweat.net>2010-04-04 07:00:24 -0700
commit98b4424141b4775183618bc307e0e7d09d74df6e (patch)
tree931d09f8fe662ebd7c2b31a093b85b041ade101d /activerecord/test
parentaf89c58696580ee26ffbd99ab9a3747fba937e35 (diff)
downloadrails-98b4424141b4775183618bc307e0e7d09d74df6e.tar.gz
rails-98b4424141b4775183618bc307e0e7d09d74df6e.tar.bz2
rails-98b4424141b4775183618bc307e0e7d09d74df6e.zip
Add tests to prevent regression of lazy evaluation of has_many ..., :dependent => :___
[#2627 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb18
1 files changed, 18 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 c1e539d573..b55b08bf9d 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1168,4 +1168,22 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
client = firm.clients_using_primary_key.create!(:name => 'test')
assert_equal firm.name, client.firm_name
end
+
+ def test_defining_has_many_association_with_delete_all_dependency_lazily_evaluates_target_class
+ ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never
+ class_eval <<-EOF
+ class DeleteAllModel < ActiveRecord::Base
+ has_many :nonentities, :dependent => :delete_all
+ end
+ EOF
+ end
+
+ def test_defining_has_many_association_with_nullify_dependency_lazily_evaluates_target_class
+ ActiveRecord::Reflection::AssociationReflection.any_instance.expects(:class_name).never
+ class_eval <<-EOF
+ class NullifyModel < ActiveRecord::Base
+ has_many :nonentities, :dependent => :nullify
+ end
+ EOF
+ end
end