1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Use a real file to run the test

* JRuby doesn't support multi-line -e.

1fb6657a7d
This commit is contained in:
Benoit Daloze 2020-05-09 13:10:17 +02:00 committed by Hiroshi SHIBATA
parent ae3d0d8a20
commit ff5ca548c3
Notes: git 2020-06-05 07:33:38 +09:00

View file

@ -463,13 +463,16 @@ class TestGemRequire < Gem::TestCase
newer_json = util_spec("json", "999.99.9", nil, ["lib/json.rb"])
install_gem newer_json
cmd = <<-RUBY
path = "#{@tempdir}/test_realworld_upgraded_default_gem.rb"
code = <<-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
File.write(path, code)
output = Gem::Util.popen({ 'GEM_HOME' => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
assert $?.success?
refute_empty output
assert_equal "999.99.9", output.lines[0].chomp