diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-08-22 18:20:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-22 18:20:25 +0200 |
commit | 9136bb77a73a9374078f850af056225172f1f211 (patch) | |
tree | 0f28f17619d703e46358713704e3a55495c8a735 /activerecord/test/cases/associations/has_many_associations_test.rb | |
parent | b7294944547c984bb92864493435b516e68bd623 (diff) | |
parent | 7d13e9de50e10ab49342ecff429d21d677560826 (diff) | |
download | rails-9136bb77a73a9374078f850af056225172f1f211.tar.gz rails-9136bb77a73a9374078f850af056225172f1f211.tar.bz2 rails-9136bb77a73a9374078f850af056225172f1f211.zip |
Merge pull request #33162 from utilum/stop_using_mocha
Stop using Mocha
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 0ca902385a..5e6bea17ea 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2134,21 +2134,29 @@ class HasManyAssociationsTest < ActiveRecord::TestCase 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, __FILE__, __LINE__ + 1) - class DeleteAllModel < ActiveRecord::Base - has_many :nonentities, :dependent => :delete_all - end - EOF + assert_not_called_on_instance_of( + ActiveRecord::Reflection::AssociationReflection, + :class_name, + ) do + class_eval(<<-EOF, __FILE__, __LINE__ + 1) + class DeleteAllModel < ActiveRecord::Base + has_many :nonentities, :dependent => :delete_all + end + EOF + end 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, __FILE__, __LINE__ + 1) - class NullifyModel < ActiveRecord::Base - has_many :nonentities, :dependent => :nullify - end - EOF + assert_not_called_on_instance_of( + ActiveRecord::Reflection::AssociationReflection, + :class_name, + ) do + class_eval(<<-EOF, __FILE__, __LINE__ + 1) + class NullifyModel < ActiveRecord::Base + has_many :nonentities, :dependent => :nullify + end + EOF + end end def test_attributes_are_being_set_when_initialized_from_has_many_association_with_where_clause |