Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/rubygems/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def setup
@orig_env = ENV.to_hash
@tmp = File.expand_path("tmp")

Dir.mkdir @tmp
FileUtils.mkdir_p @tmp

ENV['GEM_VENDOR'] = nil
ENV['GEMRC'] = nil
Expand All @@ -322,7 +322,7 @@ def setup
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
@tempdir.tap(&Gem::UNTAINT)

FileUtils.mkdir @tempdir
FileUtils.mkdir_p @tempdir

@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
Expand Down Expand Up @@ -429,11 +429,8 @@ def teardown
$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
Expand All @@ -448,7 +445,7 @@ def teardown

Dir.chdir @current_dir

FileUtils.rm_rf @tmp
FileUtils.rm_rf @tempdir

ENV.replace(@orig_env)

Expand Down