aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 01:43:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 01:43:01 +0000
commitd98c88103a5ffbaae9b237e223f5cc5fbe1505da (patch)
tree65a8860d1397d99e15aedb3c449bf96c96578f13 /lib/rubygems
parent51e100ef5eb11df4d9626ace7642e98eea96fa37 (diff)
downloadruby-d98c88103a5ffbaae9b237e223f5cc5fbe1505da.tar.gz
test_case.rb: fix multiple load
* lib/rubygems/test_case.rb (teardown): do not delete features loaded from the original load paths, the same libraries should be loaded again when the same features are required. [ruby-dev:49031] [Bug #11222] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/test_case.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 9edb6b48bd..9d46be7091 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -342,7 +342,18 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def teardown
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
- $LOADED_FEATURES.replace @orig_LOADED_FEATURES if @orig_LOADED_FEATURES
+ if @orig_LOADED_FEATURES
+ if @orig_LOAD_PATH
+ paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
+ ($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
+ unless paths.any? {|path| feat.start_with?(path)}
+ $LOADED_FEATURES.delete(feat)
+ end
+ end
+ else
+ $LOADED_FEATURES.replace @orig_LOADED_FEATURES
+ end
+ end
if @orig_BASERUBY
RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY