[rubygems/rubygems] Clear `RUBY_CODESIGN` env var while running tests

The `RUBY_CODESIGN` environment variable is used by mkmf-generated
Makefile to sign extension bundles on macOS. The variable specifies a
key identifier to use for signing given by the user. However, the key
is usually stored in `$HOME/Library/Keychains` directory, and the test
suite creates a fake `$HOME` directory. This causes the test suite to
try to find the specified key from the fake home directory, which
results in a failure.

https://github.com/rubygems/rubygems/commit/ddcfc65bf7
This commit is contained in:
Yuta Saito 2024-03-04 14:15:10 +09:00 коммит произвёл git
Родитель 2d8788e90c
Коммит ef5af32799
2 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -38,6 +38,10 @@ module Spec
FileUtils.mkdir_p(Path.tmpdir)
ENV["HOME"] = Path.home.to_s
# Remove "RUBY_CODESIGN", which is used by mkmf-generated Makefile to
# sign extension bundles on macOS, to avoid trying to find the specified key
# from the fake $HOME/Library/Keychains directory.
ENV.delete "RUBY_CODESIGN"
ENV["TMPDIR"] = Path.tmpdir.to_s
require "rubygems/user_interaction"

Просмотреть файл

@ -351,6 +351,10 @@ class Gem::TestCase < Test::Unit::TestCase
Dir.chdir @tempdir
ENV["HOME"] = @userhome
# Remove "RUBY_CODESIGN", which is used by mkmf-generated Makefile to
# sign extension bundles on macOS, to avoid trying to find the specified key
# from the fake $HOME/Library/Keychains directory.
ENV.delete "RUBY_CODESIGN"
Gem.instance_variable_set :@config_file, nil
Gem.instance_variable_set :@user_home, nil
Gem.instance_variable_set :@config_home, nil