aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_setup_command.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-02-01 11:14:04 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-02-01 11:14:57 +0900
commit600a715c9bde99fe2e9a669465d78833445273e8 (patch)
tree8244622e8cc02b40dd0dad29d30fc60a11342396 /test/rubygems/test_gem_commands_setup_command.rb
parentadc303131187654d8ce83f3db17eefa3d5bae26c (diff)
downloadruby-600a715c9bde99fe2e9a669465d78833445273e8.tar.gz
Merge the current master branch of rubygems/rubygems.
Just started to develop RubyGems 3.2.0.
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index c63f7177c7..9dc88d582a 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -98,6 +98,18 @@ class TestGemCommandsSetupCommand < Gem::TestCase
File.join @gemhome, 'bin', name
end
+ def gem_install_with_plugin(name)
+ gem = util_spec name do |s|
+ s.files = %W[lib/rubygems_plugin.rb]
+ end
+ write_file File.join @tempdir, 'lib', 'rubygems_plugin.rb' do |f|
+ f.puts "require '#{gem.plugins.first}'"
+ end
+ install_gem gem
+
+ File.join Gem.plugins_dir, "#{name}_plugin.rb"
+ end
+
def test_execute_regenerate_binstubs
gem_bin_path = gem_install 'a'
write_file gem_bin_path do |io|
@@ -123,6 +135,31 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_equal "I changed it!\n", File.read(gem_bin_path)
end
+ def test_execute_regenerate_plugins
+ gem_plugin_path = gem_install_with_plugin 'a'
+ write_file gem_plugin_path do |io|
+ io.puts 'I changed it!'
+ end
+
+ @cmd.options[:document] = []
+ @cmd.execute
+
+ assert_match %r{\Arequire}, File.read(gem_plugin_path)
+ end
+
+ def test_execute_no_regenerate_plugins
+ gem_plugin_path = gem_install_with_plugin 'a'
+ write_file gem_plugin_path do |io|
+ io.puts 'I changed it!'
+ end
+
+ @cmd.options[:document] = []
+ @cmd.options[:regenerate_plugins] = false
+ @cmd.execute
+
+ assert_equal "I changed it!\n", File.read(gem_plugin_path)
+ end
+
def test_execute_informs_about_installed_executables
use_ui @ui do
@cmd.execute