summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-08-06 12:21:23 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-31 19:06:14 +0900
commit9fa5c4cd0721f720282dfc9efe5657b136c7e99b (patch)
treefb2e1f497b5f9fbd48907bb9f8b5449b113c17b5 /test/rubygems/test_gem.rb
parent21db5876caeb8f67dfef6f9010e4ab7639d39c1b (diff)
[rubygems/rubygems] Also load user installed rubygems plugins
https://github.com/rubygems/rubygems/commit/82960c262f
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4789
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r--test/rubygems/test_gem.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 0d4b1571ca..da154dac75 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1578,6 +1578,31 @@ class TestGem < Gem::TestCase
assert_equal %w[plugin], PLUGINS_LOADED
end
+ def test_load_user_installed_plugins
+ plugin_path = File.join "lib", "rubygems_plugin.rb"
+
+ Dir.chdir @tempdir do
+ FileUtils.mkdir_p 'lib'
+ File.open plugin_path, "w" do |fp|
+ fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
+ end
+
+ foo = util_spec 'foo', '1' do |s|
+ s.files << plugin_path
+ end
+
+ install_gem_user foo
+ end
+
+ Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
+
+ gem 'foo'
+
+ Gem.load_plugins
+
+ assert_equal %w[plugin], PLUGINS_LOADED
+ end
+
def test_load_env_plugins
with_plugin('load') { Gem.load_env_plugins }
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil