diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-04-27 17:00:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 17:00:49 -0400 |
commit | a189adf4e5d58dcb05012b3b569d1de2fa496974 (patch) | |
tree | 1d8059720d7dde453fbbec00b205f39604e3f786 /activerecord/test/cases/associations | |
parent | bb2a3afafbcdfac3294479f042cb7a8f7f3d6739 (diff) | |
parent | d1f58e9922de753b5a6b1dc7a8ff2a6cf9463eeb (diff) | |
download | rails-a189adf4e5d58dcb05012b3b569d1de2fa496974.tar.gz rails-a189adf4e5d58dcb05012b3b569d1de2fa496974.tar.bz2 rails-a189adf4e5d58dcb05012b3b569d1de2fa496974.zip |
Merge pull request #32727 from utilum/assert_dont_expects
Use MethodCallAssertions instead of mocha expects
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 2e0a7ab1ab..bf2e051def 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1996,8 +1996,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase def test_calling_many_should_defer_to_collection_if_using_a_block firm = companies(:first_firm) assert_queries(1) do - firm.clients.expects(:size).never - firm.clients.many? { true } + assert_not_called(firm.clients, :size) do + firm.clients.many? { true } + end end assert_predicate firm.clients, :loaded? end @@ -2035,8 +2036,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase def test_calling_none_should_defer_to_collection_if_using_a_block firm = companies(:first_firm) assert_queries(1) do - firm.clients.expects(:size).never - firm.clients.none? { true } + assert_not_called(firm.clients, :size) do + firm.clients.none? { true } + end end assert_predicate firm.clients, :loaded? end @@ -2070,8 +2072,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase def test_calling_one_should_defer_to_collection_if_using_a_block firm = companies(:first_firm) assert_queries(1) do - firm.clients.expects(:size).never - firm.clients.one? { true } + assert_not_called(firm.clients, :size) do + firm.clients.one? { true } + end end assert_predicate firm.clients, :loaded? end @@ -2112,9 +2115,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end def test_association_proxy_transaction_method_starts_transaction_in_association_class - Comment.expects(:transaction) - Post.first.comments.transaction do - # nothing + assert_called(Comment, :transaction) do + Post.first.comments.transaction do + # nothing + end end end |