From e6d7389c2b036c59ad26c91d68b66ff4bf4e571b Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 2 Apr 2018 04:20:07 +0000 Subject: [PATCH] Keep feature names loaded in the block * lib/rubygems/test_case.rb (Gem::TestCase#save_loaded_features): keep feature names for rubygem libraries loaded in the block. c.f. rubygems/rubygems#2261 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/test_case.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 39aa4fc9a7..bb6f4fde88 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -756,6 +756,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase old_loaded_features = $LOADED_FEATURES.dup yield ensure + prefix = File.dirname(__FILE__) + "/" + new_features = ($LOADED_FEATURES - old_loaded_features) + old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0)}) $LOADED_FEATURES.replace old_loaded_features end