summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-19 07:20:17 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-19 07:20:17 +0000
commit92e726628e3baf4acb1a349089aa4d3278c2ad40 (patch)
tree8baeecc921ee199adf113a4d7ca030cccf96e5b3 /test
parentb0f6781e2f225bb6787233504de482b988bc9a81 (diff)
Merge RubyGems 3.0.0 from upstream.
https://blog.rubygems.org/2018/12/19/3.0.0-released.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_bundled_ca.rb2
-rw-r--r--test/rubygems/test_gem.rb4
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb6
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb20
4 files changed, 26 insertions, 6 deletions
diff --git a/test/rubygems/test_bundled_ca.rb b/test/rubygems/test_bundled_ca.rb
index d56a374e1d5..97a64af3236 100644
--- a/test/rubygems/test_bundled_ca.rb
+++ b/test/rubygems/test_bundled_ca.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'rubygems/test_case'
-require 'net/http'
+require 'net/https'
require 'rubygems/request'
# = Testing Bundled CA
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 682fa84612e..e062eebbaa3 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -5,6 +5,7 @@ require 'rubygems/command'
require 'rubygems/installer'
require 'pathname'
require 'tmpdir'
+require 'rbconfig'
# TODO: push this up to test_case.rb once battle tested
@@ -13,6 +14,7 @@ $LOAD_PATH.map! do |path|
end
class TestGem < Gem::TestCase
+ RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
@@ -181,7 +183,7 @@ class TestGem < Gem::TestCase
dir_mode = (options[:dir_mode] & mask).to_s(8)
data_mode = (options[:data_mode] & mask).to_s(8)
expected = {
- 'bin/foo.cmd' => prog_mode,
+ "bin/#{RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd')}" => prog_mode,
'gems/foo-1' => dir_mode,
'gems/foo-1/bin' => dir_mode,
'gems/foo-1/data' => dir_mode,
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index d788c19ad56..f1598f3fc29 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -113,9 +113,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.options[:env_shebang] = true
@cmd.execute
- default_gem_bin_path = File.join @install_dir, 'bin', 'gem'
+ gem_exec = sprintf Gem.default_exec_format, 'gem'
+ default_gem_bin_path = File.join @install_dir, 'bin', gem_exec
if Gem::USE_BUNDLER_FOR_GEMDEPS
- default_bundle_bin_path = File.join @install_dir, 'bin', 'bundle'
+ bundle_exec = sprintf Gem.default_exec_format, 'bundle'
+ default_bundle_bin_path = File.join @install_dir, 'bin', bundle_exec
end
ruby_exec = sprintf Gem.default_exec_format, 'ruby'
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 5029a6a6fda..a725fe205c2 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -835,11 +835,27 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_do_not_follow_insecure_redirect
ssl_server = self.class.start_ssl_server
- temp_ca_cert = File.join(DIR, 'ca_cert.pem'),
+ temp_ca_cert = File.join(DIR, 'ca_cert.pem')
+ expected_error_message =
+ "redirecting to non-https resource: #{@server_uri} (https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri})"
+
with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher|
- assert_raises Gem::RemoteFetcher::FetchError do
+ err = assert_raises Gem::RemoteFetcher::FetchError do
fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri}")
end
+
+ assert_equal(err.message, expected_error_message)
+ end
+ end
+
+ def test_nil_ca_cert
+ ssl_server = self.class.start_ssl_server
+ temp_ca_cert = nil
+
+ with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher|
+ assert_raises Gem::RemoteFetcher::FetchError do
+ fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}")
+ end
end
end