1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-10-24 15:52:37 +02:00
parent 342fbae83c
commit 148961adcd
47 changed files with 725 additions and 61 deletions

View file

@ -12,7 +12,22 @@ module CodeLoadingSpecs
end
end
def self.preload_rubygems
# Require RubyGems eagerly, to ensure #require is already the RubyGems
# version and RubyGems is only loaded once, before starting #require/#autoload specs
# which snapshot $LOADED_FEATURES and could cause RubyGems to load twice.
# #require specs also snapshot #require, and could end up redefining #require as the original core Kernel#require.
@rubygems ||= begin
require "rubygems"
true
rescue LoadError
true
end
end
def self.spec_setup
preload_rubygems
@saved_loaded_features = $LOADED_FEATURES.clone
@saved_load_path = $LOAD_PATH.clone
ScratchPad.record []