diff options
author | bronzdoc <lsagastume1990@gmail.com> | 2019-06-23 20:03:50 -0600 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-07-31 07:47:01 +0800 |
commit | 688ccc96020258acb4c02a2f8c5ff6e5a0bbc966 (patch) | |
tree | 932522a984f1a289a6c6fc9dadba8dbba524e069 /test | |
parent | 8103d46a4d9591ae95f9a3c31619d1b12031cf3c (diff) |
[rubygems/rubygems] Move metadata method to Gem::Package
https://github.com/rubygems/rubygems/commit/2c9cfcb666
Diffstat (limited to 'test')
-rw-r--r-- | test/rubygems/test_gem_package.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb index cedd2f5e55..c7b3cb3e20 100644 --- a/test/rubygems/test_gem_package.rb +++ b/test/rubygems/test_gem_package.rb @@ -420,6 +420,33 @@ class TestGemPackage < Gem::Package::TarTestCase assert_equal %w[lib/code.rb], reader.contents end + def test_metadata + data_tgz = util_tar_gz { } + + gem = util_tar do |tar| + tar.add_file 'data.tar.gz', 0644 do |io| + io.write data_tgz.string + end + + tar.add_file 'metadata.gz', 0644 do |io| + Zlib::GzipWriter.wrap io do |gzio| + gzio.write @spec.to_yaml + end + end + end + + gem_path = "#{@destination}/test.gem" + + File.open gem_path, "wb" do |io| + io.write gem.string + end + + spec, metadata = Gem::Package.metadata(gem_path) + + assert_equal @spec, spec + assert_match @spec.to_yaml, metadata.force_encoding("UTF-8") + end + def test_contents package = Gem::Package.new @gem |