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:
parent
ce0f977ae9
commit
36ff09d7da
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue