[rubygems/rubygems] Reset Gem.state_file
along with Gem.state_home
As `Gem.state_file` is placed under `Gem.state_home` directory, when the latter is reset, also the former should be reset. If left unreset, the file for a previously run test will be re-created and will not be deleted. https://github.com/rubygems/rubygems/commit/1378d07afd
This commit is contained in:
parent
1fa4d15ca7
commit
6ecb14df2c
@ -76,6 +76,8 @@ class Gem::TestCase < Test::Unit::TestCase
|
|||||||
|
|
||||||
attr_accessor :uri # :nodoc:
|
attr_accessor :uri # :nodoc:
|
||||||
|
|
||||||
|
@@tempdirs = []
|
||||||
|
|
||||||
def assert_activate(expected, *specs)
|
def assert_activate(expected, *specs)
|
||||||
specs.each do |spec|
|
specs.each do |spec|
|
||||||
case spec
|
case spec
|
||||||
@ -287,7 +289,8 @@ class Gem::TestCase < Test::Unit::TestCase
|
|||||||
|
|
||||||
FileUtils.mkdir_p @tmp
|
FileUtils.mkdir_p @tmp
|
||||||
|
|
||||||
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
@tempdir = Dir.mktmpdir(method_name.to_s, @tmp)
|
||||||
|
@@tempdirs << @tempdir
|
||||||
|
|
||||||
ENV["GEM_VENDOR"] = nil
|
ENV["GEM_VENDOR"] = nil
|
||||||
ENV["GEMRC"] = nil
|
ENV["GEMRC"] = nil
|
||||||
@ -354,6 +357,7 @@ class Gem::TestCase < Test::Unit::TestCase
|
|||||||
Gem.instance_variable_set :@config_home, nil
|
Gem.instance_variable_set :@config_home, nil
|
||||||
Gem.instance_variable_set :@data_home, nil
|
Gem.instance_variable_set :@data_home, nil
|
||||||
Gem.instance_variable_set :@state_home, @statehome
|
Gem.instance_variable_set :@state_home, @statehome
|
||||||
|
Gem.instance_variable_set :@state_file, nil
|
||||||
Gem.instance_variable_set :@gemdeps, nil
|
Gem.instance_variable_set :@gemdeps, nil
|
||||||
Gem.instance_variable_set :@env_requirements_by_name, nil
|
Gem.instance_variable_set :@env_requirements_by_name, nil
|
||||||
Gem.send :remove_instance_variable, :@ruby_version if
|
Gem.send :remove_instance_variable, :@ruby_version if
|
||||||
@ -470,6 +474,8 @@ class Gem::TestCase < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
@back_ui.close
|
@back_ui.close
|
||||||
|
|
||||||
|
assert_empty @@tempdirs.select {|tempdir| File.exist?(tempdir) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def credential_setup
|
def credential_setup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user