mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Split credential helper as credential_setup and use it
https://github.com/rubygems/rubygems/commit/b0c55c76ca
This commit is contained in:
parent
18ac783ea6
commit
58af4c0a1f
Notes:
git
2020-05-08 14:14:07 +09:00
5 changed files with 16 additions and 4 deletions
|
@ -359,10 +359,6 @@ class Gem::TestCase < Minitest::Test
|
|||
ENV['HOME'] = @userhome
|
||||
FileUtils.mkdir_p File.join(@userhome, ".gem")
|
||||
File.write File.join(@userhome, ".gemrc"), "--- {}"
|
||||
temp_cred = File.join(@userhome, '.gem', 'credentials')
|
||||
FileUtils.mkdir_p File.dirname(temp_cred)
|
||||
File.write temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
|
||||
File.chmod 0600, temp_cred
|
||||
|
||||
Gem.instance_variable_set :@user_home, nil
|
||||
Gem.instance_variable_set :@cache_home, nil
|
||||
|
@ -479,6 +475,13 @@ class Gem::TestCase < Minitest::Test
|
|||
@back_ui.close
|
||||
end
|
||||
|
||||
def credential_setup
|
||||
@temp_cred = File.join(@userhome, '.gem', 'credentials')
|
||||
FileUtils.mkdir_p File.dirname(@temp_cred)
|
||||
File.write @temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
|
||||
File.chmod 0600, @temp_cred
|
||||
end
|
||||
|
||||
def common_installer_setup
|
||||
common_installer_teardown
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class TestGemCommandsOwnerCommand < Gem::TestCase
|
|||
def setup
|
||||
super
|
||||
|
||||
credential_setup
|
||||
|
||||
ENV["RUBYGEMS_HOST"] = nil
|
||||
@stub_ui = Gem::MockGemUi.new
|
||||
@stub_fetcher = Gem::FakeFetcher.new
|
||||
|
|
|
@ -6,6 +6,9 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|||
|
||||
def setup
|
||||
super
|
||||
|
||||
credential_setup
|
||||
|
||||
ENV["RUBYGEMS_HOST"] = nil
|
||||
Gem.host = Gem::DEFAULT_HOST
|
||||
Gem.configuration.disable_default_gem_server = false
|
||||
|
|
|
@ -8,6 +8,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
|||
def setup
|
||||
super
|
||||
|
||||
credential_setup
|
||||
|
||||
Gem.configuration.rubygems_api_key = nil
|
||||
Gem.configuration.api_keys.clear
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class TestGemConfigFile < Gem::TestCase
|
|||
def setup
|
||||
super
|
||||
|
||||
credential_setup
|
||||
|
||||
@temp_conf = File.join @tempdir, '.gemrc'
|
||||
|
||||
@cfg_args = %W[--config-file #{@temp_conf}]
|
||||
|
|
Loading…
Add table
Reference in a new issue