diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-03-24 07:39:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 15:39:24 +0900 |
commit | 96064e6f1ce100a37680dc8f9509f06b3350e9c8 (patch) | |
tree | 798b59f015cb82ee3cd0427f80584032175829ba /test/rubygems/test_gem_commands_setup_command.rb | |
parent | 930b012ad96bfb0bd12446b89407120744ef92eb (diff) | |
download | ruby-96064e6f1ce100a37680dc8f9509f06b3350e9c8.tar.gz |
Sync rubygems with current master (#2889)
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_setup_command.rb | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index d2e04d760b..30daa82d61 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -107,7 +107,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase end install_gem gem - File.join Gem.plugins_dir, "#{name}_plugin.rb" + File.join Gem.plugindir, "#{name}_plugin.rb" end def test_execute_regenerate_binstubs @@ -160,6 +160,18 @@ class TestGemCommandsSetupCommand < Gem::TestCase assert_equal "I changed it!\n", File.read(gem_plugin_path) end + def test_execute_regenerate_plugins_creates_plugins_dir_if_not_there + gem_plugin_path = gem_install_with_plugin 'a' + + # Simulate gem installed with an older rubygems without a plugins layout + FileUtils.rm_rf Gem.plugindir + + @cmd.options[:document] = [] + @cmd.execute + + assert_match %r{\Arequire}, File.read(gem_plugin_path) + end + def test_execute_informs_about_installed_executables use_ui @ui do @cmd.execute @@ -184,11 +196,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase ruby_exec = sprintf Gem.default_exec_format, 'ruby' - bin_env = win_platform? ? "" : %w(/usr/bin/env /bin/env).find {|f| File.executable?(f) } - - assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(default_gem_bin_path) - assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(default_bundle_bin_path) - assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(gem_bin_path) + if Gem.win_platform? + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_gem_bin_path) + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_bundle_bin_path) + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(gem_bin_path) + else + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_gem_bin_path) + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_bundle_bin_path) + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(gem_bin_path) + end end def test_pem_files_in |