summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_setup_command.rb
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-05-18 15:10:18 +0000
committergit <svn-admin@ruby-lang.org>2021-11-05 07:23:36 +0900
commit1506c8228b775776ce846e5cfdb6ce4b81963808 (patch)
tree21b6857ad5dbd1747d1509ba226d9f27fd0645f9 /test/rubygems/test_gem_commands_setup_command.rb
parent9503dd91a5b207d2215f7873b0442f52d2eb5c94 (diff)
[rubygems/rubygems] Don't apply `--destdir` twice when running `setup.rb`
Prior to this patch, if I ran: ruby setup.rb --destdir /foo Then Bundler files would be written into /foo/foo, because destdir was being prepended, even though `bundler_spec.bin_dir` already included destdir. https://github.com/rubygems/rubygems/commit/9e857ffb52
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 3aa6bfa2fe..b66943610d 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -246,6 +246,28 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
end
+ def test_install_default_bundler_gem_with_destdir_flag
+ @cmd.extend FileUtils
+
+ bin_dir = File.join(@gemhome, 'bin')
+
+ bindir(bin_dir) do
+ destdir = File.join(@tempdir, 'foo')
+
+ @cmd.options[:destdir] = destdir
+
+ @cmd.install_default_bundler_gem bin_dir
+
+ bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
+ default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
+ spec = Gem::Specification.load(default_spec_path)
+
+ spec.executables.each do |e|
+ assert_path_exist File.join destdir, spec.bin_dir.gsub(/^[a-zA-Z]:/, ''), e
+ end
+ end
+ end
+
def test_remove_old_lib_files
lib = File.join @install_dir, 'lib'
lib_rubygems = File.join lib, 'rubygems'