aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorJosef Šimánek <josef.simanek@gmail.com>2020-04-19 00:50:28 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:13:29 +0900
commita0c4d14acfa17877d6c1d58e5960513f152b493c (patch)
tree3d3670ee48f69650ef75431ce44bba8138e7a882 /test/rubygems/test_gem_installer.rb
parent3315ce69044b511c7fe5d462985756a7948e95d1 (diff)
downloadruby-a0c4d14acfa17877d6c1d58e5960513f152b493c.tar.gz
[rubygems/rubygems] Fix symlink RubyGems test problems for non-admin user.
https://github.com/rubygems/rubygems/commit/75f672ff0e
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb26
1 files changed, 7 insertions, 19 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 34759a8fd0..8020a42690 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -3,24 +3,6 @@ require 'rubygems/installer_test_case'
class TestGemInstaller < Gem::InstallerTestCase
- @@symlink_supported = nil
-
- # Our CI does not currently hit the "symlink not supported" case, but this is
- # needed for Windows developers without symlink support enabled (the default
- # for non admin) to be able to run the tests successfully
- 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
common_installer_setup
@@ -2097,7 +2079,13 @@ gem 'other', version
assert_path_exists installed_exec
wrapper = File.read installed_exec
- refute_match %r{generated by RubyGems}, wrapper
+
+ if symlink_supported?
+ refute_match %r{generated by RubyGems}, wrapper
+ else # when symlink not supported, it warns and fallbacks back to installing wrapper
+ assert_match %r{Unable to use symlinks, installing wrapper}, @ui.error
+ assert_match %r{generated by RubyGems}, wrapper
+ end
end
def test_default_gem_with_wrappers