diff --git a/test/rubygems/test_gem_package_tar_header.rb b/test/rubygems/test_gem_package_tar_header.rb index 8f1f0c4561..9977e282a1 100644 --- a/test/rubygems/test_gem_package_tar_header.rb +++ b/test/rubygems/test_gem_package_tar_header.rb @@ -31,6 +31,8 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase new_header = Gem::Package::TarHeader.from io assert_headers_equal @tar_header, new_header + ensure + io.close! end def test_initialize diff --git a/test/rubygems/test_gem_package_tar_reader.rb b/test/rubygems/test_gem_package_tar_reader.rb index 5e0474c253..aa45417b0d 100644 --- a/test/rubygems/test_gem_package_tar_reader.rb +++ b/test/rubygems/test_gem_package_tar_reader.rb @@ -20,6 +20,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase end assert_equal 2, entries + ensure + io.close! end def test_rewind @@ -30,7 +32,9 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase content + "\0" * (512 - content.size) str << "\0" * 1024 - Gem::Package::TarReader.new(TempIO.new(str)) do |tar_reader| + io = TempIO.new(str) + + Gem::Package::TarReader.new(io) do |tar_reader| 3.times do tar_reader.rewind i = 0 @@ -41,6 +45,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase assert_equal(1, i) end end + ensure + io.close! end def test_seek @@ -58,6 +64,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase assert_equal 0, io.pos end + ensure + io.close! end def test_seek_missing @@ -73,6 +81,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase assert_equal 0, io.pos end + ensure + io.close! end end diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb index 3c1bf7291a..641f2c0192 100644 --- a/test/rubygems/test_gem_package_tar_reader_entry.rb +++ b/test/rubygems/test_gem_package_tar_reader_entry.rb @@ -16,6 +16,11 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase @entry = util_entry @tar end + def teardown + @entry.instance_variable_get(:@io).close! + super + end + def test_bytes_read assert_equal 0, @entry.bytes_read diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb index 2505d7ced1..96f62b0f5d 100644 --- a/test/rubygems/test_gem_package_tar_writer.rb +++ b/test/rubygems/test_gem_package_tar_writer.rb @@ -14,6 +14,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase def teardown @tar_writer.close unless @tar_writer.closed? + @io.close! super end