diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-23 08:01:09 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-23 13:29:40 +0900 |
commit | 36ff09d7da72dbb4b55229cbf76b3b316775625f (patch) | |
tree | 29e2e02ba3224c863a5d3db195e62f779922b2b9 /activesupport | |
parent | ce0f977ae94305f9df332b7ff5e7859f3d489ebc (diff) | |
download | rails-36ff09d7da72dbb4b55229cbf76b3b316775625f.tar.gz rails-36ff09d7da72dbb4b55229cbf76b3b316775625f.tar.bz2 rails-36ff09d7da72dbb4b55229cbf76b3b316775625f.zip |
Test try! with a block
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/core_ext/object_and_class_ext_test.rb | 4 |
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 |