diff options
author | Josef Šimánek <josef.simanek@gmail.com> | 2020-04-19 00:50:28 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 14:13:29 +0900 |
commit | a0c4d14acfa17877d6c1d58e5960513f152b493c (patch) | |
tree | 3d3670ee48f69650ef75431ce44bba8138e7a882 /test | |
parent | 3315ce69044b511c7fe5d462985756a7948e95d1 (diff) |
[rubygems/rubygems] Fix symlink RubyGems test problems for non-admin user.
https://github.com/rubygems/rubygems/commit/75f672ff0e
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3092
Diffstat (limited to 'test')
-rw-r--r-- | test/rubygems/test_gem_installer.rb | 26 | ||||
-rw-r--r-- | test/rubygems/test_gem_uninstaller.rb | 2 |
2 files changed, 9 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 diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index 9a98c1e590..9229fee842 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -154,6 +154,8 @@ class TestGemUninstaller < Gem::InstallerTestCase end def test_remove_symlinked_gem_home + skip "Symlinks not supported or not enabled" unless symlink_supported? + Dir.mktmpdir("gem_home") do |dir| symlinked_gem_home = "#{dir}/#{File.basename(@gemhome)}" |