Permalink
Browse files

Add tests to prevent regression of lazy evaluation of has_many ..., :…

…dependent => :___

[#2627 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent af89c58 commit 98b4424141b4775183618bc307e0e7d09d74df6e @pixeltrix pixeltrix committed with jeremy Apr 4, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1168,4 +1168,22 @@ def test_creating_using_primary_key
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

0 comments on commit 98b4424

Please sign in to comment.