summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parent3315ce69044b511c7fe5d462985756a7948e95d1 (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 'lib')
-rw-r--r--lib/rubygems/installer_test_case.rb17
1 files changed, 17 insertions, 0 deletions
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