Projects
openEuler:24.03:SP1:Everything:64G
rubygem-railties
_service:tar_scm:rubygem-railties-7.0.2.3-Remov...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:rubygem-railties-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch of Package rubygem-railties
From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001 From: John Crepezzi <john.crepezzi@gmail.com> 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 <eileencodes@gmail.com> --- railties/test/generators/actions_test.rb | 14 ++-- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index f62754fe0813e..6b5cdcf781922 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -734,11 +734,17 @@ def assert_runs(commands, config = {}, &block) config_matcher = ->(actual_config) do assert_equal config, actual_config.slice(*config.keys) end if config - args = Array(commands).map { |command| [command, *config_matcher] } - - assert_called_with(generator, :run, args) do - block.call - end + + mock = Minitest::Mock.new + + Array(commands).each do |command| + args = [command, *config_matcher] + mock.expect(:call, nil, args) + end + + generator.stub(:run, mock, &block) + + assert_mock(mock) end def assert_routes(*route_commands)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2