1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Test try! with a block

This commit is contained in:
Akira Matsuda 2013-01-23 08:01:09 +09:00
parent ce0f977ae9
commit 36ff09d7da

View file

@ -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