diff options
author | David RodrÃguez <[email protected]> | 2020-06-16 16:26:31 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2020-06-17 21:16:56 +0900 |
commit | 106d616cc8a5c95a2944f9ea3d7f99ee54042cdd (patch) | |
tree | 599279fb85457b315b00deb3d7efa2afce511fa0 /lib/rubygems/test_case.rb | |
parent | f5459acd79c30dbea3062e48fb2b12d510c5b868 (diff) |
Make sure to only reset "dummy" $LOADED_FEATURES
Namely, those generated under `/tmp`.
The previous approach was brittle and broken in the case of ruby-core,
because under that setup, the current folder is in the original
`$LOAD_PATH`, and dummy features are created under `./tmp`, so they were
failing to be reset.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3213
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r-- | lib/rubygems/test_case.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index bb8355ff9d..9e1c8ea952 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -429,11 +429,8 @@ class Gem::TestCase < Minitest::Test $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH if @orig_LOADED_FEATURES if @orig_LOAD_PATH - paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/") } ($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat| - unless paths.any? {|path| feat.start_with?(path) } - $LOADED_FEATURES.delete(feat) - end + $LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp) end else $LOADED_FEATURES.replace @orig_LOADED_FEATURES |