summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-04-29 06:50:02 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:13:29 +0900
commit58af4c0a1fdf15e1624867938d5a9ce6be8403e3 (patch)
treecb39943db73858d2603a673f32e7ef5c984d35de
parent18ac783ea6ad00b664d784661643bcbabc5e48eb (diff)
[rubygems/rubygems] Split credential helper as credential_setup and use it
https://github.com/rubygems/rubygems/commit/b0c55c76ca
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3092
-rw-r--r--lib/rubygems/test_case.rb11
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb3
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb2
-rw-r--r--test/rubygems/test_gem_config_file.rb2
5 files changed, 16 insertions, 4 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 2bf4fb05e4..0609519efa 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -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
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 35424629fe..685365ed3b 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -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
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index ddb287388d..877621d489 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -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
diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb
index fee67fe438..8991f65302 100644
--- a/test/rubygems/test_gem_commands_signin_command.rb
+++ b/test/rubygems/test_gem_commands_signin_command.rb
@@ -8,6 +8,8 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def setup
super
+ credential_setup
+
Gem.configuration.rubygems_api_key = nil
Gem.configuration.api_keys.clear
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index d31d55eba1..36725f9390 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -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}]