File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -941,11 +941,18 @@ def test_freeze_tree_bang
941941 assert_equal ( 'ABC' , @root . content , "Content should be 'ABC'" )
942942 @root . freeze_tree!
943943 # Note: The error raised here depends on the Ruby version.
944- # For Ruby > 2.6 , FrozenError is raised
944+ # For Ruby > 2.5 , FrozenError is raised
945945 # For Ruby > 1.9, RuntimeError is raised
946946 # For Ruby ~ 1.8, TypeError is raised
947- assert_raise ( RuntimeError , FrozenError , TypeError ) { @root . content = '123' }
948- assert_raise ( RuntimeError , FrozenError , TypeError ) { @root [ 0 ] . content = '123' }
947+ require 'rubygems' # Only needed for ruby pre-1.9.0 but it's safe for later versions (evaluates to false).
948+ if Gem ::Version . new ( RUBY_VERSION ) <= Gem ::Version . new ( '1.9.0' )
949+ assert_raise ( RuntimeError , TypeError ) { @root . content = '123' }
950+ assert_raise ( RuntimeError , TypeError ) { @root [ 0 ] . content = '123' }
951+ else
952+ assert_raise ( FrozenError ) { @root . content = '123' }
953+ assert_raise ( FrozenError ) { @root [ 0 ] . content = '123' }
954+ end
955+
949956 end
950957
951958 # Test whether the content is accessible
You can’t perform that action at this time.
0 commit comments