From ec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 1 Feb 2011 03:11:34 +0000 Subject: Import rubygems 1.5.0 (released version @ 1fb59d0) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rubygems/test_gem_package_tar_input.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'test/rubygems/test_gem_package_tar_input.rb') diff --git a/test/rubygems/test_gem_package_tar_input.rb b/test/rubygems/test_gem_package_tar_input.rb index 0d3de45ba4..72c1ce194a 100644 --- a/test/rubygems/test_gem_package_tar_input.rb +++ b/test/rubygems/test_gem_package_tar_input.rb @@ -59,7 +59,24 @@ class TestGemPackageTarInput < Gem::Package::TarTestCase @entry_contents = %w[0123456789 01234] end - def test_each_works + def test_initialize_no_metadata_file + Tempfile.open 'no_meta' do |io| + io.write tar_file_header('a', '', 0644, 1) + io.write 'a' + io.rewind + + e = assert_raises Gem::Package::FormatError do + open io.path, Gem.binary_mode do |file| + Gem::Package::TarInput.open file do end + end + end + + assert_equal "no metadata found in #{io.path}", e.message + assert_equal io.path, e.path + end + end + + def test_each open @file, 'rb' do |io| Gem::Package::TarInput.open io do |tar_input| count = 0 @@ -79,7 +96,7 @@ class TestGemPackageTarInput < Gem::Package::TarTestCase end end - def test_extract_entry_works + def test_extract_entry open @file, 'rb' do |io| Gem::Package::TarInput.open io do |tar_input| assert_equal @spec, tar_input.metadata -- cgit v1.2.3