1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Set config_file_name to the value of ENV["GEMRC"] if available

https://github.com/rubygems/rubygems/commit/471239f1fa
This commit is contained in:
bronzdoc 2019-05-28 23:07:01 -06:00 committed by Hiroshi SHIBATA
parent 6f60ead756
commit 7990d8dc50
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 8 additions and 2 deletions

View file

@ -473,7 +473,7 @@ if you believe they were disclosed to a third party.
private
def set_config_file_name(args)
@config_file_name = nil
@config_file_name = ENV["GEMRC"] || nil
need_config_file_name = false
args.each do |arg|

View file

@ -19,7 +19,7 @@ class TestGemConfigFile < Gem::TestCase
Gem::ConfigFile::PLATFORM_DEFAULTS.clear
@env_gemrc = ENV['GEMRC']
ENV['GEMRC'] = ''
ENV['GEMRC'] = nil
util_config_file
end
@ -167,6 +167,12 @@ class TestGemConfigFile < Gem::TestCase
assert_equal 2048, @cfg.bulk_threshold
end
def test_set_config_file_name_from_environment_variable
ENV['GEMRC'] = "/tmp/.gemrc"
cfg = Gem::ConfigFile.new([])
assert_equal cfg.config_file_name, "/tmp/.gemrc"
end
def test_api_keys
assert_nil @cfg.instance_variable_get :@api_keys