From 7d76314885be3532999684356657ce36da84d04e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 30 Jun 2020 21:23:37 +0900 Subject: Merge RubyGems 3.1.4 --- lib/rubygems/test_case.rb | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'lib/rubygems/test_case.rb') diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 206497c651..89403206f9 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -96,6 +96,8 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__)) + SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__) + def assert_activate(expected, *specs) specs.each do |spec| case spec @@ -169,20 +171,24 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni # original value when the block ends # def bindir(value) - bindir = RbConfig::CONFIG['bindir'] + with_clean_path_to_ruby do + bindir = RbConfig::CONFIG['bindir'] - if value - RbConfig::CONFIG['bindir'] = value - else - RbConfig::CONFIG.delete 'bindir' - end + if value + RbConfig::CONFIG['bindir'] = value + else + RbConfig::CONFIG.delete 'bindir' + end - yield - ensure - if bindir - RbConfig::CONFIG['bindir'] = bindir - else - RbConfig::CONFIG.delete 'bindir' + begin + yield + ensure + if bindir + RbConfig::CONFIG['bindir'] = bindir + else + RbConfig::CONFIG.delete 'bindir' + end + end end end @@ -1247,6 +1253,16 @@ Also, a list: end end + def with_clean_path_to_ruby + orig_ruby = Gem.ruby + + Gem.instance_variable_set :@ruby, nil + + yield + ensure + Gem.instance_variable_set :@ruby, orig_ruby + end + class << self # :nodoc: -- cgit v1.2.3