summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_install_update_options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_install_update_options.rb')
-rw-r--r--test/rubygems/test_gem_install_update_options.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index e2225a1eba..8fd5d9c543 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require_relative "installer_test_case"
require "rubygems/install_update_options"
require "rubygems/command"
@@ -129,6 +130,9 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
end
def test_user_install_disabled_read_only
+ pend "skipped on MS Windows (chmod has no effect)" if Gem.win_platform?
+ pend "skipped in root privilege" if Process.uid.zero?
+
@spec = quick_gem "a" do |spec|
util_make_exec spec
end
@@ -136,26 +140,20 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
util_build_gem @spec
@gem = @spec.cache_file
- if win_platform?
- pend("test_user_install_disabled_read_only test skipped on MS Windows")
- elsif Process.uid.zero?
- pend("test_user_install_disabled_read_only test skipped in root privilege")
- else
- @cmd.handle_options %w[--no-user-install]
+ @cmd.handle_options %w[--no-user-install]
- refute @cmd.options[:user_install]
+ refute @cmd.options[:user_install]
- FileUtils.chmod 0755, @userhome
- FileUtils.chmod 0000, @gemhome
+ FileUtils.chmod 0o755, @userhome
+ FileUtils.chmod 0o000, @gemhome
- Gem.use_paths @gemhome, @userhome
+ Gem.use_paths @gemhome, @userhome
- assert_raise(Gem::FilePermissionError) do
- Gem::Installer.at(@gem, @cmd.options).install
- end
+ assert_raise(Gem::FilePermissionError) do
+ Gem::Installer.at(@gem, @cmd.options).install
end
ensure
- FileUtils.chmod 0755, @gemhome
+ FileUtils.chmod 0o755, @gemhome
end
def test_vendor