From 6ffef8d459e6423bf4fe35cccb24345bad862448 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 2 Jul 2019 14:41:34 +0900 Subject: [PATCH] Clean up temporary expired cert file --- test/rubygems/test_gem_commands_cert_command.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb index e9e1a353c1..fd1e66b915 100644 --- a/test/rubygems/test_gem_commands_cert_command.rb +++ b/test/rubygems/test_gem_commands_cert_command.rb @@ -30,6 +30,14 @@ class TestGemCommandsCertCommand < Gem::TestCase @cmd = Gem::Commands::CertCommand.new @trust_dir = Gem::Security.trust_dir + + @cleanup = [] + end + + def teardown + FileUtils.rm_f(@cleanup) + + super end def test_certificates_matching @@ -597,6 +605,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis assert_equal '/CN=nobody/DC=example', EXPIRED_PUBLIC_CERT.issuer.to_s tmp_expired_cert_file = File.join(Dir.tmpdir, File.basename(EXPIRED_PUBLIC_CERT_FILE)) + @cleanup << tmp_expired_cert_file File.write(tmp_expired_cert_file, File.read(EXPIRED_PUBLIC_CERT_FILE)) @cmd.handle_options %W[ @@ -628,6 +637,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis assert_equal '/CN=nobody/DC=example', EXPIRED_PUBLIC_CERT.issuer.to_s tmp_expired_cert_file = File.join(Dir.tmpdir, File.basename(EXPIRED_PUBLIC_CERT_FILE)) + @cleanup << tmp_expired_cert_file File.write(tmp_expired_cert_file, File.read(EXPIRED_PUBLIC_CERT_FILE)) @cmd.handle_options %W[