summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb4
-rw-r--r--lib/rubygems/test_case.rb4
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 7af0694402..dd01fa3838 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -577,6 +577,10 @@ module Gem
# gem's paths are inserted before site lib directory by default.
def self.load_path_insert_index
+ $LOAD_PATH.each_with_index do |path, i|
+ return i if path.instance_variable_defined?(:@gem_prelude_index)
+ end
+
index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
index
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index aee4b75773..9edb6b48bd 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -269,7 +269,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.ensure_gem_subdirectories @gemhome
@orig_LOAD_PATH = $LOAD_PATH.dup
- $LOAD_PATH.map! { |s| File.expand_path(s).untaint }
+ $LOAD_PATH.map! { |s|
+ (expand_path = File.expand_path(s)) == s ? s : expand_path.untaint
+ }
Dir.chdir @tempdir