ruby-changes:56639
From: Nobuyoshi <ko1@a...>
Date: Wed, 24 Jul 2019 19:16:29 +0900 (JST)
Subject: [ruby-changes:56639] Nobuyoshi Nakada: 99680f81e8 (master): [rubygems/rubygems] Resolve `@@project_dir` from test file paths
https://git.ruby-lang.org/ruby.git/commit/?id=99680f81e8 From 99680f81e832506792cf32d830d09954acd220fc Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 24 Jul 2019 13:24:18 +0900 Subject: [rubygems/rubygems] Resolve `@@project_dir` from test file paths `Dir.pwd` may differ from the source path. Test directories and files should be resolved from test file paths. https://github.com/rubygems/rubygems/commit/e18e7c81b4 diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index b466e7a..a8cc5d0 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -232,8 +232,6 @@ class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Uni https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L232 undef_method :default_test if instance_methods.include? 'default_test' or instance_methods.include? :default_test - @@project_dir = Dir.pwd.untaint unless defined?(@@project_dir) - ## # #setup prepares a sandboxed location to install gems. All installs are # directed to a temporary directory. All install plugins are removed. diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index c90ad2d..a08a86d 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -17,6 +17,8 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L17 PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant + @@project_dir = File.expand_path('../../..', __FILE__).untaint + def setup super diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb index 6ada96f..73bfd20 100644 --- a/test/rubygems/test_gem_command_manager.rb +++ b/test/rubygems/test_gem_command_manager.rb @@ -4,6 +4,8 @@ require 'rubygems/command_manager' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_command_manager.rb#L4 class TestGemCommandManager < Gem::TestCase + @@project_dir = File.expand_path('../../..', __FILE__).untaint + def setup super -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/