summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
-rw-r--r--test/rubygems/test_gem.rb14
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb2
-rw-r--r--test/rubygems/test_gem_package.rb59
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb2
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb2
-rw-r--r--test/rubygems/test_gem_security_policy.rb6
-rw-r--r--test/rubygems/test_gem_server.rb16
-rw-r--r--test/rubygems/test_gem_specification.rb2
-rw-r--r--test/rubygems/test_gem_version.rb1
9 files changed, 77 insertions, 27 deletions
@@ -387,7 +387,7 @@ class TestGem < Gem::TestCase
assert_equal %w[https://rubygems.org/], Gem.default_sources
end
- def test_self_detect_gemdeps
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
@@ -399,7 +399,7 @@ class TestGem < Gem::TestCase
begin
Dir.chdir 'detect/a/b'
- assert_equal add_bundler_full_name([]), Gem.detect_gemdeps.map(&:full_name)
ensure
Dir.chdir @tempdir
end
@@ -1214,7 +1214,7 @@ class TestGem < Gem::TestCase
input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" +
"\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"
- output = Gem.gunzip input
assert_equal 'hello', output
@@ -1226,7 +1226,7 @@ class TestGem < Gem::TestCase
def test_self_gzip
input = 'hello'
- output = Gem.gzip input
zipped = StringIO.new output
@@ -1450,12 +1450,12 @@ class TestGem < Gem::TestCase
ENV['RUBYGEMS_GEMDEPS'] = path
- Gem.detect_gemdeps
assert_equal add_bundler_full_name(%W(a-1 b-1 c-1)), loaded_spec_names
end
- def test_auto_activation_of_detected_gemdeps_file
skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
util_clear_gems
@@ -1476,7 +1476,7 @@ class TestGem < Gem::TestCase
ENV['RUBYGEMS_GEMDEPS'] = "-"
expected_specs = [a, b, (Gem::USE_BUNDLER_FOR_GEMDEPS || nil) && util_spec("bundler", Bundler::VERSION), c].compact
- assert_equal expected_specs, Gem.detect_gemdeps.sort_by { |s| s.name }
end
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
@@ -10,7 +10,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
if File.exist?(bundler_gemspec)
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
else
- BUNDLER_VERS = "1.16.1"
end
def setup
@@ -524,6 +524,21 @@ class TestGemPackage < Gem::Package::TarTestCase
assert_path_exists extracted
end
def test_install_location
package = Gem::Package.new @gem
@@ -607,7 +622,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_load_spec
- entry = StringIO.new Gem.gzip @spec.to_yaml
def entry.full_name() 'metadata.gz' end
package = Gem::Package.new 'nonexistent.gem'
@@ -637,7 +652,7 @@ class TestGemPackage < Gem::Package::TarTestCase
data_tgz = data_tgz.string
gem = util_tar do |tar|
- metadata_gz = Gem.gzip @spec.to_yaml
tar.add_file 'metadata.gz', 0444 do |io|
io.write metadata_gz
@@ -684,7 +699,7 @@ class TestGemPackage < Gem::Package::TarTestCase
data_tgz = data_tgz.string
gem = util_tar do |tar|
- metadata_gz = Gem.gzip @spec.to_yaml
tar.add_file 'metadata.gz', 0444 do |io|
io.write metadata_gz
@@ -721,7 +736,7 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_verify_corrupt
tf = Tempfile.open 'corrupt' do |io|
- data = Gem.gzip 'a' * 10
io.write \
tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
io.write data
@@ -845,7 +860,7 @@ class TestGemPackage < Gem::Package::TarTestCase
build.add_contents gem
# write bogus data.tar.gz to foil signature
- bogus_data = Gem.gzip 'hello'
fake_signer = Class.new do
def digest_name; 'SHA512'; end
def digest_algorithm; Digest(:SHA512); end
@@ -903,6 +918,40 @@ class TestGemPackage < Gem::Package::TarTestCase
end
assert_equal "package is corrupt, exception while verifying: whatever (ArgumentError) in #{@gem}", e.message
end
def test_spec
@@ -158,7 +158,7 @@ group\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000
header_s[124, 12] = val
io = TempIO.new header_s
assert_raises ArgumentError do
- new_header = Gem::Package::TarHeader.from io
end
io.close! if io.respond_to? :close!
end
@@ -541,7 +541,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime, head = nil)
- Gem.gzip 'foo'
end
assert_equal 'foo', fetcher.fetch_path(@uri + 'foo.gz')
@@ -450,7 +450,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@spec.cert_chain = [PUBLIC_CERT.to_s]
- metadata_gz = Gem.gzip @spec.to_yaml
package = Gem::Package.new 'nonexistent.gem'
package.checksums[Gem::Security::DIGEST_NAME] = {}
@@ -473,7 +473,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@spec.cert_chain = [PUBLIC_CERT.to_s]
- metadata_gz = Gem.gzip @spec.to_yaml
package = Gem::Package.new 'nonexistent.gem'
package.checksums[Gem::Security::DIGEST_NAME] = {}
@@ -502,7 +502,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@spec.cert_chain = [PUBLIC_CERT.to_s]
- metadata_gz = Gem.gzip @spec.to_yaml
package = Gem::Package.new 'nonexistent.gem'
package.checksums[Gem::Security::DIGEST_NAME] = {}
@@ -127,7 +127,7 @@ class TestGemServer < Gem::TestCase
assert_match %r| \d\d:\d\d:\d\d |, @res['date']
assert_equal 'application/x-gzip', @res['content-type']
assert_equal [['a', Gem::Version.new(2), Gem::Platform::RUBY]],
- Marshal.load(Gem.gunzip(@res.body))
end
def test_listen
@@ -177,7 +177,7 @@ class TestGemServer < Gem::TestCase
assert_match %r| \d\d:\d\d:\d\d |, @res['date']
assert_equal 'application/x-gzip', @res['content-type']
assert_equal [['a', v('3.a'), Gem::Platform::RUBY]],
- Marshal.load(Gem.gunzip(@res.body))
end
def test_quick_gemdirs
@@ -236,7 +236,7 @@ class TestGemServer < Gem::TestCase
assert @res['date']
assert_equal 'application/x-deflate', @res['content-type']
- spec = Marshal.load Gem.inflate(@res.body)
assert_equal 'a', spec.name
assert_equal Gem::Version.new(1), spec.version
end
@@ -253,7 +253,7 @@ class TestGemServer < Gem::TestCase
assert @res['date']
assert_equal 'application/x-deflate', @res['content-type']
- spec = Marshal.load Gem.inflate(@res.body)
assert_equal 'a', spec.name
assert_equal Gem::Version.new(1), spec.version
assert_equal Gem::Platform.local, spec.platform
@@ -269,7 +269,7 @@ class TestGemServer < Gem::TestCase
assert @res['date']
assert_equal 'application/x-deflate', @res['content-type']
- spec = Marshal.load Gem.inflate(@res.body)
assert_equal 'a', spec.name
assert_equal v('3.a'), spec.version
end
@@ -286,7 +286,7 @@ class TestGemServer < Gem::TestCase
assert @res['date']
assert_equal 'application/x-deflate', @res['content-type']
- spec = Marshal.load Gem.inflate(@res.body)
assert_equal 'a-b', spec.name
assert_equal v('3.a'), spec.version
end
@@ -303,7 +303,7 @@ class TestGemServer < Gem::TestCase
assert @res['date']
assert_equal 'application/x-deflate', @res['content-type']
- spec = Marshal.load Gem.inflate(@res.body)
assert_equal 'a-b-1', spec.name
assert_equal v('3.a'), spec.version
end
@@ -571,7 +571,7 @@ class TestGemServer < Gem::TestCase
assert_equal [['a', Gem::Version.new(1), Gem::Platform::RUBY],
['a', Gem::Version.new(2), Gem::Platform::RUBY],
['a', v('3.a'), Gem::Platform::RUBY]],
- Marshal.load(Gem.gunzip(@res.body))
end
def test_uri_encode
@@ -1133,7 +1133,7 @@ dependencies: []
def test_handles_private_null_type
path = File.join DATA_PATH, "null-type.gemspec.rz"
- data = Marshal.load Gem.inflate(Gem.read_binary(path))
assert_equal nil, data.rubyforge_project
end
@@ -46,6 +46,7 @@ class TestGemVersion < Gem::TestCase
def test_class_correct
assert_equal true, Gem::Version.correct?("5.1")
assert_equal false, Gem::Version.correct?("an incorrect version")
end
def test_class_new_subclass