File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,15 +148,8 @@ def test_version_current
148148 end
149149
150150 version = RUBY_VERSION . split ( "." ) . tap { |segments | segments [ 0 ] = segments [ 0 ] . succ } . join ( "." )
151- stub_ruby_version ( version ) do
152- error = assert_raise ( CurrentVersionError ) { Prism . parse ( "1 + 1" , version : "current" ) }
153- assert_includes error . message , "unknown"
154- end
155-
156- stub_ruby_version ( "2.7.0" ) do
157- error = assert_raise ( CurrentVersionError ) { Prism . parse ( "1 + 1" , version : "current" ) }
158- assert_includes error . message , "minimum"
159- end
151+ assert_includes CurrentVersionError . new ( version ) . message , "unknown"
152+ assert_includes CurrentVersionError . new ( "2.7" ) . message , "minimum"
160153 end
161154
162155 def test_scopes
@@ -186,16 +179,5 @@ def find_source_file_node(program)
186179 queue . concat ( node . compact_child_nodes )
187180 end
188181 end
189-
190- def stub_ruby_version ( version )
191- old_version = RUBY_VERSION
192-
193- Object . send ( :remove_const , :RUBY_VERSION )
194- Object . const_set ( :RUBY_VERSION , version )
195- yield
196- ensure
197- Object . send ( :remove_const , :RUBY_VERSION )
198- Object . const_set ( :RUBY_VERSION , old_version )
199- end
200182 end
201183end
You can’t perform that action at this time.
0 commit comments