summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-28 00:33:08 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-28 00:33:08 +0000
commit4e53f3ad72d16ec251ba92233ce4757a3bc13618 (patch)
tree5795b83f4ca64ebee9a9f1586cfd6489eafce0e4 /test
parent7a3f794da0fbfacb99c0721271990d39c9885928 (diff)
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.4.
Please see entries of 2.6.4 on https://github.com/rubygems/rubygems/blob/master/History.txt git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/rubygems_plugin.rb4
-rw-r--r--test/rubygems/test_gem_installer.rb27
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb8
-rw-r--r--test/rubygems/test_remote_fetch_error.rb21
4 files changed, 56 insertions, 4 deletions
diff --git a/test/rubygems/rubygems_plugin.rb b/test/rubygems/rubygems_plugin.rb
index 0195a2139a..30a67789c6 100644
--- a/test/rubygems/rubygems_plugin.rb
+++ b/test/rubygems/rubygems_plugin.rb
@@ -6,6 +6,10 @@ require 'rubygems/command_manager'
#
# DO NOT include code like this in your rubygems_plugin.rb
+module Gem::Commands
+ remove_const(:InterruptCommand) if defined?(InterruptCommand)
+end
+
class Gem::Commands::InterruptCommand < Gem::Command
def initialize
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index f9149650f0..dedb4c99ca 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -2,6 +2,20 @@
require 'rubygems/installer_test_case'
class TestGemInstaller < Gem::InstallerTestCase
+ @@symlink_supported = nil
+
+ def symlink_supported?
+ if @@symlink_supported.nil?
+ begin
+ File.symlink("", "")
+ rescue Errno::ENOENT, Errno::EEXIST
+ @@symlink_supported = true
+ rescue NotImplementedError, SystemCallError
+ @@symlink_supported = false
+ end
+ end
+ @@symlink_supported
+ end
def setup
super
@@ -552,7 +566,7 @@ gem 'other', version
end
def test_generate_bin_symlink_update_older
- return if win_platform? #Windows FS do not support symlinks
+ return if !symlink_supported?
@installer.wrappers = false
util_make_exec
@@ -588,7 +602,7 @@ gem 'other', version
end
def test_generate_bin_symlink_update_remove_wrapper
- return if win_platform? #Windows FS do not support symlinks
+ return if !symlink_supported?
@installer.wrappers = true
util_make_exec
@@ -639,7 +653,12 @@ gem 'other', version
installed_exec = File.join(util_inst_bindir, 'executable')
assert_path_exists installed_exec
- assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
+ if symlink_supported?
+ assert_send([File, :symlink?, installed_exec])
+ return
+ end
+
+ assert_match(/Unable to use symlinks, installing wrapper/i,
@ui.error)
wrapper = File.read installed_exec
@@ -651,7 +670,7 @@ gem 'other', version
end
def test_generate_bin_uses_default_shebang
- return if win_platform? #Windows FS do not support symlinks
+ return if !symlink_supported?
@installer.wrappers = true
util_make_exec
diff --git a/test/rubygems/test_gem_source_fetch_problem.rb b/test/rubygems/test_gem_source_fetch_problem.rb
index 7392a1ef0a..4a245f25df 100644
--- a/test/rubygems/test_gem_source_fetch_problem.rb
+++ b/test/rubygems/test_gem_source_fetch_problem.rb
@@ -16,5 +16,13 @@ class TestGemSourceFetchProblem < Gem::TestCase
assert_equal 'test', e.message
end
+ def test_password_redacted
+ source = Gem::Source.new 'https://username:secret@gemsource.com'
+ error = RuntimeError.new 'test'
+
+ sf = Gem::SourceFetchProblem.new source, error
+
+ refute_match sf.wordy, 'secret'
+ end
end
diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb
new file mode 100644
index 0000000000..6b0f5477d6
--- /dev/null
+++ b/test/rubygems/test_remote_fetch_error.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+require 'rubygems/test_case'
+
+class TestRemoteFetchError < Gem::TestCase
+
+ def test_password_redacted
+ error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://user:secret@gemsource.org')
+ refute_match error.to_s, 'secret'
+ end
+
+ def test_invalid_url
+ error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://::gemsource.org')
+ assert_equal error.to_s, 'There was an error fetching (https://::gemsource.org)'
+ end
+
+ def test_to_s
+ error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://gemsource.org')
+ assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)'
+ end
+end
+