Skip to content

Commit 13265de

Browse files
authored
Merge pull request rails#50581 from seanpdoyle/method-call-asserts-with-ruby-2-7
Remove `MethodCallAssertions` Ruby 2.7 work-around
2 parents a73cbbe + 7abaeea commit 13265de

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

activesupport/lib/active_support/testing/method_call_assertions.rb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,8 @@ def assert_not_called(object, method_name, message = nil, &block)
3030
assert_called(object, method_name, message, times: 0, &block)
3131
end
3232

33-
#--
34-
# This method is a temporary wrapper for mock.expect as part of
35-
# the Minitest 5.16 / Ruby 3.0 kwargs transition. It can go away
36-
# when we drop support for Ruby 2.7.
37-
if Minitest::Mock.instance_method(:expect).parameters.map(&:first).include?(:keyrest)
38-
def expect_called_with(mock, args, returns: false, **kwargs)
39-
mock.expect(:call, returns, args, **kwargs)
40-
end
41-
else
42-
def expect_called_with(mock, args, returns: false, **kwargs)
43-
if !kwargs.empty?
44-
mock.expect(:call, returns, [*args, kwargs])
45-
else
46-
mock.expect(:call, returns, args)
47-
end
48-
end
33+
def expect_called_with(mock, args, returns: false, **kwargs)
34+
mock.expect(:call, returns, args, **kwargs)
4935
end
5036

5137
def assert_called_on_instance_of(klass, method_name, message = nil, times: 1, returns: nil)

0 commit comments

Comments
 (0)