summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-03-02 20:37:31 +0900
committerNARUSE, Yui <nurse@users.noreply.github.com>2021-03-11 17:24:52 +0900
commitf375bc77d2f347dd2a44705b8abd29398feae427 (patch)
tree0988ab2b519e713ae653cc2e23609b339a9b5979 /test
parent38f8b8d070aaac02f1d048b5d9947b2e58401e2b (diff)
Merge RubyGems-3.2.11 and Bundler-2.2.11
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem.rb10
-rw-r--r--test/rubygems/test_gem_config_file.rb10
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb6
3 files changed, 24 insertions, 2 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 8b028d3495..1c6d790b25 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1958,9 +1958,15 @@ class TestGem < Gem::TestCase
io.write 'gem "a"'
end
+ platform = Bundler::GemHelpers.generic_local_platform
+ if platform == Gem::Platform::RUBY
+ platform = ''
+ else
+ platform = " #{platform}"
+ end
+
expected = <<-EXPECTED
-Could not find gem 'a' in locally installed gems.
-The source does not contain any versions of 'a'
+Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile.
You may need to `gem install -g` to install missing gems
EXPECTED
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index ddc35a9594..7db31013aa 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -41,6 +41,7 @@ class TestGemConfigFile < Gem::TestCase
assert_equal true, @cfg.verbose
assert_equal [@gem_repo], Gem.sources
assert_equal 365, @cfg.cert_expiration_length_days
+ assert_equal false, @cfg.ipv4_fallback_enabled
File.open @temp_conf, 'w' do |fp|
fp.puts ":backtrace: true"
@@ -56,6 +57,7 @@ class TestGemConfigFile < Gem::TestCase
fp.puts ":ssl_verify_mode: 0"
fp.puts ":ssl_ca_cert: /etc/ssl/certs"
fp.puts ":cert_expiration_length_days: 28"
+ fp.puts ":ipv4_fallback_enabled: true"
end
util_config_file
@@ -70,6 +72,14 @@ class TestGemConfigFile < Gem::TestCase
assert_equal 0, @cfg.ssl_verify_mode
assert_equal '/etc/ssl/certs', @cfg.ssl_ca_cert
assert_equal 28, @cfg.cert_expiration_length_days
+ assert_equal true, @cfg.ipv4_fallback_enabled
+ end
+
+ def test_initialize_ipv4_fallback_enabled_env
+ ENV['IPV4_FALLBACK_ENABLED'] = 'true'
+ util_config_file %W[--config-file #{@temp_conf}]
+
+ assert_equal true, @cfg.ipv4_fallback_enabled
end
def test_initialize_handle_arguments_config_file
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 1c88e8d3e8..32600deee2 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -962,6 +962,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
end
+ def test_tcpsocketext_require
+ with_configured_fetcher(":ipv4_fallback_enabled: true") do |fetcher|
+ refute require('rubygems/core_ext/tcpsocket_init')
+ end
+ end
+
def with_configured_fetcher(config_str = nil, &block)
if config_str
temp_conf = File.join @tempdir, '.gemrc'