From f30d38bdd08d241f8c3c1768069911e627f955f8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 16 Aug 2019 21:30:32 +0900 Subject: [PATCH] Move lib directory to the last of $LOAD_PATH on ruby repository. https://github.com/rubygems/rubygems/pull/1868 changes the behavior of require when it used with -I options. Therefore, the options of ruby repository was different from rubygems/rubygems. --- test/rubygems/test_require.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index b341249391..a0c272ed66 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -204,6 +204,14 @@ class TestGemRequire < Gem::TestCase this test, somehow require will load the benchmark in b, and ignore that the stdlib one is already in $LOADED_FEATURES?. Reproducible by running the spaceship_specific_file test before this one" if java_platform? + + lp = $LOAD_PATH.dup + lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../lib")) + if File.exist?(lib_dir) + $LOAD_PATH.delete lib_dir + $LOAD_PATH.push lib_dir + end + a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb" b1 = util_spec "b", "1", nil, "lib/benchmark.rb" b2 = util_spec "b", "2", nil, "lib/benchmark.rb" @@ -221,6 +229,8 @@ class TestGemRequire < Gem::TestCase # the same behavior as eager loading would have. assert_equal %w(a-1 b-2), loaded_spec_names + ensure + $LOAD_PATH.replace lp end def test_already_activated_direct_conflict