1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "[rubygems/rubygems] Remove unneeded global teardown"

This reverts commit 93d1588c78.
This commit is contained in:
Hiroshi SHIBATA 2020-05-08 12:39:30 +09:00
parent ceacb06311
commit ac2c07e983
Notes: git 2020-05-08 14:14:03 +09:00
11 changed files with 9 additions and 32 deletions

View file

@ -356,7 +356,12 @@ class Gem::TestCase < Minitest::Test
Dir.chdir @tempdir
ENV['HOME'] = @userhome
FileUtils.mkdir_p File.join(@userhome, ".gem")
File.write File.join(@userhome, ".gemrc"), "--- {}"
Gem.instance_variable_set :@user_home, nil
Gem.instance_variable_set :@cache_home, nil
Gem.instance_variable_set :@data_home, nil
Gem.instance_variable_set :@gemdeps, nil
Gem.instance_variable_set :@env_requirements_by_name, nil
Gem.send :remove_instance_variable, :@ruby_version if
@ -476,10 +481,6 @@ class Gem::TestCase < Minitest::Test
File.chmod 0600, @temp_cred
end
def credential_teardown
FileUtils.rm_rf @temp_cred
end
def common_installer_setup
common_installer_teardown

View file

@ -398,7 +398,6 @@ class TestGemCommandsBuildCommand < Gem::TestCase
skip 'openssl is missing' unless defined?(OpenSSL::SSL) && !java_platform?
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
Gem::Security.trust_dir
@ -442,7 +441,6 @@ class TestGemCommandsBuildCommand < Gem::TestCase
skip 'openssl is missing' unless defined?(OpenSSL::SSL) && !java_platform?
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
Gem::Security.trust_dir

View file

@ -597,7 +597,6 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
def test_execute_re_sign
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
path = File.join @tempdir, 'cert.pem'
Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600
@ -628,9 +627,6 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
end
def test_execute_re_sign_with_cert_expiration_length_days
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
path = File.join @tempdir, 'cert.pem'
Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600

View file

@ -19,12 +19,6 @@ class TestGemCommandsOwnerCommand < Gem::TestCase
@cmd = Gem::Commands::OwnerCommand.new
end
def teardown
credential_teardown
super
end
def test_show_owners
response = <<EOF
---

View file

@ -40,8 +40,6 @@ class TestGemCommandsPushCommand < Gem::TestCase
end
def teardown
credential_teardown
super
singleton_gem_class.class_eval do

View file

@ -17,8 +17,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def teardown
credential_teardown
credentials_path = Gem.configuration.credentials_path
File.delete(credentials_path) if File.exist?(credentials_path)
super
end

View file

@ -18,12 +18,6 @@ class TestGemCommandsYankCommand < Gem::TestCase
Gem.configuration.api_keys[:KEY] = 'other'
end
def teardown
credential_teardown
super
end
def test_handle_options
@cmd.handle_options %w[a --version 1.0 --platform x86-darwin -k KEY --host HOST]

View file

@ -28,8 +28,6 @@ class TestGemConfigFile < Gem::TestCase
ENV['GEMRC'] = @env_gemrc
credential_teardown
super
end

View file

@ -25,8 +25,6 @@ class TestGemGemcutterUtilities < Gem::TestCase
ENV['RUBYGEMS_HOST'] = nil
Gem.configuration.rubygems_api_key = nil
credential_teardown
super
end

View file

@ -228,7 +228,7 @@ class TestGemSource < Gem::TestCase
end
def test_update_cache_eh_home_nonexistent
FileUtils.rmdir Gem.user_home
FileUtils.rm_rf Gem.user_home
refute @source.update_cache?
end

View file

@ -33,7 +33,7 @@ class TestGemSpecFetcher < Gem::TestCase
end
def test_initialize_nonexistent_home_dir
FileUtils.rmdir Gem.user_home
FileUtils.rm_rf Gem.user_home
assert Gem::SpecFetcher.new
end