diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-10-26 18:17:22 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-12-05 14:28:41 +0900 |
commit | 7ab877761e0577b1cd29811173971305bfadcead (patch) | |
tree | 635e730d8adcced37a42aaa0ec52751b57c357e5 /test/rubygems | |
parent | 4a71852f757d9c18c023f3f6e993cdf55f74411d (diff) | |
download | ruby-7ab877761e0577b1cd29811173971305bfadcead.tar.gz |
[rubygems/rubygems] Instead of checking writability, try to write
Checking writability is prone to errors. For example:
$ mkdir -p foo/bar
$ chmod -w foo
$ touch foo/bar/baz # succeeds even if foo is not writable
https://github.com/rubygems/rubygems/commit/6056138b6a
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_gem_commands_install_command.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 0c4e1efc78..c38c94e5e2 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -193,7 +193,7 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a pend "skipped in root privilege" if Process.uid.zero? spec_fetcher do |fetcher| - fetcher.gem "a", 2 + fetcher.download "a", 2 end @cmd.options[:user_install] = false @@ -204,12 +204,14 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a FileUtils.chmod 0o755, @userhome FileUtils.chmod 0o555, @gemhome - assert_raise Gem::FilePermissionError do + assert_raise Gem::MockGemUi::SystemExitException, @ui.error do @cmd.execute end ensure FileUtils.chmod 0o755, @gemhome end + + assert_equal %w[a-2], @cmd.installed_specs.map(&:full_name).sort end def test_execute_local_missing |