ruby-changes:61557
From: Benoit <ko1@a...>
Date: Fri, 5 Jun 2020 07:34:40 +0900 (JST)
Subject: [ruby-changes:61557] ae3d0d8a20 (master): [rubygems/rubygems] Add a more comprehensive and reliable test for upgraded default gems
https://git.ruby-lang.org/ruby.git/commit/?id=ae3d0d8a20 From ae3d0d8a20c74e8163957deddc30ac81e40be353 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Sat, 9 May 2020 12:40:57 +0200 Subject: [rubygems/rubygems] Add a more comprehensive and reliable test for upgraded default gems * Test that the correct version is loaded and that the default gem is not loaded at all. https://github.com/rubygems/rubygems/commit/ee08508b2a diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 9e66be5..7a46093 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -452,9 +452,31 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L452 puts Gem.loaded_specs["json"] RUBY output = Gem::Util.popen(*ruby_with_rubygems_in_load_path, "-e", cmd).strip + assert $?.success? refute_empty output end + def test_realworld_upgraded_default_gem + testing_ruby_repo = !ENV["GEM_COMMAND"].nil? + skip "this test can't work under ruby-core setup" if testing_ruby_repo + + newer_json = util_spec("json", "999.99.9", nil, ["lib/json.rb"]) + install_gem newer_json + + cmd = <<-RUBY + $stderr = $stdout + require "json" + puts Gem.loaded_specs["json"].version + puts $LOADED_FEATURES + RUBY + output = Gem::Util.popen({ 'GEM_HOME' => @gemhome }, *ruby_with_rubygems_in_load_path, "-e", cmd).strip + assert $?.success? + refute_empty output + assert_equal "999.99.9", output.lines[0].chomp + # Make sure only files from the newer json gem are loaded, and no files from the default json gem + assert_equal ["#{@gemhome}/gems/json-999.99.9/lib/json.rb"], output.lines.grep(%r{/gems/json-}).map(&:chomp) + end + def test_default_gem_and_normal_gem default_gem_spec = new_default_spec("default", "2.0.0.0", nil, "default/gem.rb") -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/