File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 149
149
# For the last example, single-digit versions are automatically extended with
150
150
# a zero to give a sensible result.
151
151
152
+ # Our code style opens classes directly without opening the intermediate
153
+ # modules. This works because tha main entrypoint `rubygems.rb`, which defines
154
+ # the root `Gem` module, is usually required first. But in this case we want to
155
+ # allow using `Gem::Version` without loading the rest of rubygems, so we
156
+ # explicit define the `Gem` placeholder module first.
157
+ module Gem ; end
158
+
159
+ require_relative "deprecate"
160
+
152
161
class Gem ::Version
153
162
autoload :Requirement , File . expand_path ( 'requirement' , __dir__ )
154
163
Original file line number Diff line number Diff line change @@ -17,4 +17,16 @@ def test_require_rubygems_package
17
17
18
18
assert status . success? , err
19
19
end
20
+
21
+ def test_require_and_use_rubygems_version
22
+ err , status = Open3 . capture2e (
23
+ *ruby_with_rubygems_in_load_path ,
24
+ "--disable-gems" ,
25
+ "-rrubygems/version" ,
26
+ "-e" ,
27
+ "Gem::Version.new('2.7.0.preview1') >= Gem::Version.new(RUBY_VERSION)"
28
+ )
29
+
30
+ assert status . success? , err
31
+ end
20
32
end
You can’t perform that action at this time.
0 commit comments