summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-11-05 20:57:41 +0100
committergit <svn-admin@ruby-lang.org>2021-12-05 05:47:46 +0900
commita72aecac3ae81e955997e4d789504e60196e2697 (patch)
tree58b5704ade519a5fa10c35bc613529bed43d69dc /test
parent9dc76e102ec00bb93b7aafaaa1309ca426d02595 (diff)
[rubygems/rubygems] Don't write outside of destdir when regenerating plugins
https://github.com/rubygems/rubygems/commit/141ef4cb9a
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 08f94d52bf..5cf94a1dc9 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -156,6 +156,21 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_bin_path)
end
+ def test_destdir_flag_does_not_try_to_write_to_the_default_gem_home
+ FileUtils.chmod "-w", File.join(@gemhome, "plugins")
+
+ destdir = File.join(@tempdir, 'foo')
+
+ @cmd.options[:destdir] = destdir
+ @cmd.execute
+
+ spec = Gem::Specification.load("bundler/bundler.gemspec")
+
+ spec.executables.each do |e|
+ assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
+ end
+ end
+
def test_files_in
assert_equal %w[rubygems.rb rubygems/requirement.rb rubygems/ssl_certs/rubygems.org/foo.pem],
@cmd.files_in('lib').sort