From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Thu, 16 Jun 2022 08:34:05 -0400 Subject: [PATCH] Remove the multi-call form of assert_called_with The `assert_called_with` helper allows passing a multi-dimensional array to mock multiple calls to the same method for a given block. This works fine now, but when adding support for real kwargs arguments to line up with recent upgrades in Minitest, this approach is no longer workable because we can't pass multiple sets of differing kwargs. Rather than complicated this method further, this commit removes the multi-call form of `assert_called_with` and modifies the tests that currently make use of that functionality to just use the underlying `Minitest::Mock` calls. Co-authored-by: Eileen M. Uchitelle --- .../testing/method_call_assertions.rb | 7 +- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb index c8d2dbaa52ab5..72451faaa8cc4 100644 --- a/activesupport/lib/active_support/testing/method_call_assertions.rb +++ b/activesupport/lib/active_support/testing/method_call_assertions.rb @@ -19,12 +19,7 @@ def assert_called(object, method_name, message = nil, times: 1, returns: nil, &b def assert_called_with(object, method_name, args, returns: nil, &block) mock = Minitest::Mock.new - - if args.all?(Array) - args.each { |arg| mock.expect(:call, returns, arg) } - else - mock.expect(:call, returns, args) - end + mock.expect(:call, returns, args) object.stub(method_name, mock, &block)