summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-16 21:30:32 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-17 07:47:19 +0900
commitf30d38bdd08d241f8c3c1768069911e627f955f8 (patch)
treeefad9b66d3a8ebfdb544aa02bff4495cc85087ea /test/rubygems
parentae3002b5401fb8b38d9a3a9b9e27e6a36ac79ff2 (diff)
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.
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_require.rb10
1 files changed, 10 insertions, 0 deletions
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