diff options
| -rw-r--r-- | activesupport/lib/active_support/testing/method_call_assertions.rb | 2 | ||||
| -rw-r--r-- | activesupport/test/testing/method_call_assertions_test.rb | 6 | 
2 files changed, 7 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 517f02e3ef..155d3344d3 100644 --- a/activesupport/lib/active_support/testing/method_call_assertions.rb +++ b/activesupport/lib/active_support/testing/method_call_assertions.rb @@ -5,7 +5,7 @@ module ActiveSupport          def assert_called(object, method_name, message = nil, times: 1)            times_called = 0 -          object.stub(method_name, -> { times_called += 1 }) { yield } +          object.stub(method_name, proc { times_called += 1 }) { yield }            error = "Expected #{method_name} to be called #{times} times, " \              "but was called #{times_called} times" diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb index 652cbda8da..2939cf0233 100644 --- a/activesupport/test/testing/method_call_assertions_test.rb +++ b/activesupport/test/testing/method_call_assertions_test.rb @@ -27,6 +27,12 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase      end    end +  def test_assert_called_method_with_arguments +    assert_called(@object, :<<) do +      @object << 2 +    end +  end +    def test_assert_called_failure      error = assert_raises(Minitest::Assertion) do        assert_called(@object, :increment) do  | 
