summaryrefslogtreecommitdiff
path: root/lib/rubygems/test_case.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2021-02-01 16:17:16 +0100
committerHiroshi SHIBATA <[email protected]>2021-03-08 13:47:35 +0900
commit53468cc11147b0d285fc376fc546b677dad600ca (patch)
treeeb9c97f544d089be2d324126b025b11f41a22c90 /lib/rubygems/test_case.rb
parent2ab6b7a7516e1b2c48a66ce513afabb62d101461 (diff)
Sync latest development version of bundler & rubygems
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4143
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r--lib/rubygems/test_case.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 79bd3e2a60..e2763561c6 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -301,7 +301,9 @@ class Gem::TestCase < Minitest::Test
def setup
@orig_env = ENV.to_hash
- @tmp = Dir.mktmpdir("tmp", Dir.pwd)
+ @tmp = File.expand_path("tmp")
+
+ FileUtils.mkdir_p @tmp
ENV['GEM_VENDOR'] = nil
ENV['GEMRC'] = nil
@@ -310,7 +312,6 @@ class Gem::TestCase < Minitest::Test
ENV['XDG_DATA_HOME'] = nil
ENV['SOURCE_DATE_EPOCH'] = nil
ENV['BUNDLER_VERSION'] = nil
- ENV["TMPDIR"] = @tmp
@current_dir = Dir.pwd
@fetcher = nil
@@ -321,13 +322,10 @@ class Gem::TestCase < Minitest::Test
# capture output
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
- tmpdir = File.realpath Dir.tmpdir
- tmpdir.tap(&Gem::UNTAINT)
-
- @tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
+ @tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
@tempdir.tap(&Gem::UNTAINT)
- FileUtils.mkdir_p @tempdir
+ ENV["TMPDIR"] = @tempdir
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
@@ -366,7 +364,9 @@ class Gem::TestCase < Minitest::Test
Dir.chdir @tempdir
ENV['HOME'] = @userhome
+ Gem.instance_variable_set :@config_file, nil
Gem.instance_variable_set :@user_home, nil
+ Gem.instance_variable_set :@config_home, nil
Gem.instance_variable_set :@data_home, nil
Gem.instance_variable_set :@gemdeps, nil
Gem.instance_variable_set :@env_requirements_by_name, nil
@@ -449,7 +449,6 @@ class Gem::TestCase < Minitest::Test
Dir.chdir @current_dir
FileUtils.rm_rf @tempdir
- FileUtils.rm_rf @tmp
ENV.replace(@orig_env)