mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
This commit is contained in:
parent
345461018d
commit
ae3d0d8a20
Notes:
git
2020-06-05 07:33:39 +09:00
1 changed files with 22 additions and 0 deletions
|
@ -452,9 +452,31 @@ class TestGemRequire < Gem::TestCase
|
|||
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")
|
||||
|
|
Loading…
Add table
Reference in a new issue