代码拉取完成,页面将自动刷新
From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001
From: John Crepezzi <[email protected]>
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 <[email protected]>
---
.../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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。