Permalink
Browse files

Revert "don't raise NoMethodError the tried method doesn't exists"

This reverts commit 29a5aea.
  • Loading branch information...
1 parent f8beca0 commit 3c6cbad8c8142573b670a8604fc59f0070924e1b @josevalim josevalim committed Oct 5, 2011
@@ -28,8 +28,6 @@ class Object
def try(*a, &b)
if a.empty? && block_given?
yield self
- elsif !a.empty? && !respond_to?(a.first)
- nil
else
__send__(*a, &b)
end
@@ -99,7 +99,7 @@ def setup
def test_nonexisting_method
method = :undefined_method
assert !@string.respond_to?(method)
- assert_nil @string.try(method)
+ assert_raise(NoMethodError) { @string.try(method) }
end
def test_nonexisting_method_with_arguments

0 comments on commit 3c6cbad

Please sign in to comment.