From 36ff09d7da72dbb4b55229cbf76b3b316775625f Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Wed, 23 Jan 2013 08:01:09 +0900 Subject: Test try! with a block --- activesupport/test/core_ext/object_and_class_ext_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index ec7dd6d4fb..8d748791e3 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -120,6 +120,10 @@ class ObjectTryTest < ActiveSupport::TestCase assert_raise(NoMethodError) { @string.try!(method, 'llo', 'y') } end + def test_try_only_block_bang + assert_equal @string.reverse, @string.try! { |s| s.reverse } + end + def test_valid_method assert_equal 5, @string.try(:size) end -- cgit v1.2.3