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

make sure missing method does not fail with arguments

This commit is contained in:
dmathieu 2011-05-22 00:32:58 +02:00
parent 29a5aeaae9
commit a85e00c01c

View file

@ -102,6 +102,12 @@ class ObjectTryTest < Test::Unit::TestCase
assert_nil @string.try(method)
end
def test_nonexisting_method_with_arguments
method = :undefined_method
assert !@string.respond_to?(method)
assert_nil @string.try(method, 'llo', 'y')
end
def test_valid_method
assert_equal 5, @string.try(:size)
end