summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2023-03-13 14:32:19 +0100
committergit <svn-admin@ruby-lang.org>2024-05-13 10:35:57 +0000
commit5880103450faf26da193ac914421957e37d71604 (patch)
tree7bc1d47ce6f4a6e5045fa5f6adf8d779f7ee2afd /test
parenta86ad47c940dee19bfe74a374c5ac61752026b7c (diff)
[rubygems/rubygems] Use spec.base_dir to remove plugins
The plugin loader from `@gem_home` was removed during uninstallation. However, this could leave behind the plugins for `--user-install` installed gems. Use `Gem::Specifictaions#base_dir` instead. This ensures that the plugin loader for associated .gemspec is uninstalled. https://github.com/rubygems/rubygems/commit/6047f78210
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_uninstaller.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index cd6d560ece..20a0005341 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -215,6 +215,25 @@ class TestGemUninstaller < Gem::InstallerTestCase
assert File.exist?(plugin_path), "plugin unintentionally removed"
end
+ def test_remove_plugins_user_installed
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
+ io.write "# do nothing"
+ end
+
+ @spec.files += %w[lib/rubygems_plugin.rb]
+
+ Gem::Installer.at(Gem::Package.build(@spec), force: true, user_install: true).install
+
+ plugin_path = File.join Gem.user_dir, "plugins/a_plugin.rb"
+ assert File.exist?(plugin_path), "plugin not written"
+
+ Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
+
+ Gem::Uninstaller.new(@spec.name, executables: true, force: true, user_install: true).uninstall
+
+ refute File.exist?(plugin_path), "plugin not removed"
+ end
+
def test_regenerate_plugins_for
write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "# do nothing"