diff options
author | David RodrÃguez <[email protected]> | 2021-11-05 20:57:41 +0100 |
---|---|---|
committer | git <[email protected]> | 2021-12-05 05:47:46 +0900 |
commit | a72aecac3ae81e955997e4d789504e60196e2697 (patch) | |
tree | 58b5704ade519a5fa10c35bc613529bed43d69dc /test/rubygems/test_gem_commands_setup_command.rb | |
parent | 9dc76e102ec00bb93b7aafaaa1309ca426d02595 (diff) |
[rubygems/rubygems] Don't write outside of destdir when regenerating plugins
https://github.com/rubygems/rubygems/commit/141ef4cb9a
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_setup_command.rb | 15 |
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 |