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:
parent
29a5aeaae9
commit
a85e00c01c
1 changed files with 6 additions and 0 deletions
|
@ -101,6 +101,12 @@ class ObjectTryTest < Test::Unit::TestCase
|
||||||
assert !@string.respond_to?(method)
|
assert !@string.respond_to?(method)
|
||||||
assert_nil @string.try(method)
|
assert_nil @string.try(method)
|
||||||
end
|
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
|
def test_valid_method
|
||||||
assert_equal 5, @string.try(:size)
|
assert_equal 5, @string.try(:size)
|
||||||
|
|
Loading…
Reference in a new issue