aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/lib/active_support/testing/method_call_assertions.rb7
-rw-r--r--activesupport/test/testing/method_call_assertions_test.rb7
2 files changed, 13 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb
index 0d7d62341c..e3cbe40308 100644
--- a/activesupport/lib/active_support/testing/method_call_assertions.rb
+++ b/activesupport/lib/active_support/testing/method_call_assertions.rb
@@ -15,7 +15,12 @@ module ActiveSupport
def assert_called_with(object, method_name, args = [], returns: nil)
mock = Minitest::Mock.new
- mock.expect(:call, returns, args)
+
+ if args.all? { |arg| arg.is_a?(Array) }
+ args.each { |arg| mock.expect(:call, returns, arg) }
+ else
+ mock.expect(:call, returns, args)
+ end
object.stub(method_name, mock) { yield }
diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb
index b327492b3b..a9908aea0d 100644
--- a/activesupport/test/testing/method_call_assertions_test.rb
+++ b/activesupport/test/testing/method_call_assertions_test.rb
@@ -73,6 +73,13 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase
end
end
+ def test_assert_called_with_multiple_expected_arguments
+ assert_called_with(@object, :<<, [ [ 1 ], [ 2 ] ]) do
+ @object << 1
+ @object << 2
+ end
+ end
+
def test_assert_not_called
assert_not_called(@object, :decrement) do
@object.increment