2 Star 0 Fork 16

src-openEuler/rubygem-activesupport

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rubygem-activesupport-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
yanxiaobing2020 提交于 2023-01-19 15:24 . upgrade to version 7.0.4
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/rubygem-activesupport.git
[email protected]:src-openeuler/rubygem-activesupport.git
src-openeuler
rubygem-activesupport
rubygem-activesupport
master

搜索帮助