aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2013-01-23 08:01:09 +0900
committerAkira Matsuda <ronnie@dio.jp>2013-01-23 13:29:40 +0900
commit36ff09d7da72dbb4b55229cbf76b3b316775625f (patch)
tree29e2e02ba3224c863a5d3db195e62f779922b2b9 /activesupport/test
parentce0f977ae94305f9df332b7ff5e7859f3d489ebc (diff)
downloadrails-36ff09d7da72dbb4b55229cbf76b3b316775625f.tar.gz
rails-36ff09d7da72dbb4b55229cbf76b3b316775625f.tar.bz2
rails-36ff09d7da72dbb4b55229cbf76b3b316775625f.zip
Test try! with a block
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb4
1 files changed, 4 insertions, 0 deletions
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