From a0c4d14acfa17877d6c1d58e5960513f152b493c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Sun, 19 Apr 2020 00:50:28 +0200 Subject: [rubygems/rubygems] Fix symlink RubyGems test problems for non-admin user. https://github.com/rubygems/rubygems/commit/75f672ff0e --- lib/rubygems/installer_test_case.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib') diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb index 5a3ce75c26..68200d7204 100644 --- a/lib/rubygems/installer_test_case.rb +++ b/lib/rubygems/installer_test_case.rb @@ -230,4 +230,21 @@ class Gem::InstallerTestCase < Gem::TestCase :user_install => user) end + @@symlink_supported = nil + + # This is needed for Windows environment without symlink support enabled (the default + # for non admin) to be able to skip test for features using symlinks. + 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 + end -- cgit v1.2.3