Skip to content

Commit

Permalink
Use a real file to run the test
Browse files Browse the repository at this point in the history
* JRuby doesn't support multi-line -e.
  • Loading branch information
eregon committed May 9, 2020
1 parent 2714af5 commit 1fb6657
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/rubygems/test_require.rb
Expand Up @@ -423,13 +423,16 @@ def test_realworld_upgraded_default_gem
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
Expand Down

0 comments on commit 1fb6657

Please sign in to comment.