aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/object/try_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-08-29 15:32:24 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-08-29 15:32:24 -0700
commit5e51bdda59c9ba8e5faf86294e3e431bd45f1830 (patch)
tree076ef97191adbe905dce5893dd31bc2f48624c1e /activesupport/test/core_ext/object/try_test.rb
parent39691ba2f5664aa83720fa3c2a1ca14937d29009 (diff)
downloadrails-5e51bdda59c9ba8e5faf86294e3e431bd45f1830.tar.gz
rails-5e51bdda59c9ba8e5faf86294e3e431bd45f1830.tar.bz2
rails-5e51bdda59c9ba8e5faf86294e3e431bd45f1830.zip
We tenderized the wrong method! Object#try already had the yield option, just needed some tenderloving instance_eval to fit the bill
Diffstat (limited to 'activesupport/test/core_ext/object/try_test.rb')
-rw-r--r--activesupport/test/core_ext/object/try_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/object/try_test.rb b/activesupport/test/core_ext/object/try_test.rb
index 8b754ced53..225c20fa36 100644
--- a/activesupport/test/core_ext/object/try_test.rb
+++ b/activesupport/test/core_ext/object/try_test.rb
@@ -65,6 +65,10 @@ class ObjectTryTest < ActiveSupport::TestCase
assert_equal false, ran
end
+ def test_try_with_instance_eval_block
+ assert_equal @string.reverse, @string.try { reverse }
+ end
+
def test_try_with_private_method_bang
klass = Class.new do
private