aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-09 23:38:34 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-07-31 21:07:19 +0900
commitebf008b9aea71fdf9be8dcc92faae1c024201bf9 (patch)
tree2c85c3299cf9cd7ae48addf5099bad692baee827 /test
parent6c71033ac3933cb23d9ee651ce864e164bc9b56f (diff)
downloadruby-ebf008b9aea71fdf9be8dcc92faae1c024201bf9.tar.gz
[rubygems/rubygems] Install plugins to user directory
Fixes the `Gem::FilePermissionError` without the privilege. Initialize `@plugins_dir` to the user gem directory, when installing with `--user` option. https://github.com/rubygems/rubygems/commit/21a71ac769
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_installer.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 49ecc549e9..e984c7079c 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -776,6 +776,28 @@ gem 'other', version
assert File.exist?(plugin_path), 'plugin not written to install_dir'
end
+ def test_generate_plugins_with_user_install
+ spec = quick_gem 'a' do |s|
+ write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ io.write "puts __FILE__"
+ end
+
+ s.files += %w[lib/rubygems_plugin.rb]
+ end
+
+ util_build_gem spec
+
+ File.chmod(0555, Gem.plugindir)
+ system_path = File.join(Gem.plugindir, 'a_plugin.rb')
+ user_path = File.join(Gem.plugindir(Gem.user_dir), 'a_plugin.rb')
+ installer = util_installer spec, Gem.dir, :user
+
+ assert_equal spec, installer.install
+
+ assert !File.exist?(system_path), 'plugin not written to user plugins_dir'
+ assert File.exist?(user_path), 'plugin not written to user plugins_dir'
+ end
+
def test_keeps_plugins_up_to_date
# NOTE: version a-2 is already installed by setup hooks