1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Replacing lambda with proc getting argument error because of it.

This commit is contained in:
Ronak Jangir 2015-08-15 14:14:55 +05:30
parent a293812bff
commit e49c2cd743
2 changed files with 7 additions and 1 deletions

View file

@ -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"

View file

@ -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