summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorEllen Marie Dash <me@duckie.co>2023-11-30 20:20:38 -0500
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-07 13:56:23 +0900
commit7d32830b8ce14cc130d052a4aa67495a34ed55dc (patch)
treee9a358076aed5e21cb1a66528969c0f8e2c406c5 /test/rubygems/test_gem_installer.rb
parent33bd95625756562f4865fbc6ad5c39e0cfbc26d6 (diff)
[rubygems/rubygems] Make --build-root disable auto-user-install.
https://github.com/rubygems/rubygems/commit/6a06b0763f
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 03903ff9d3..d0f213fb8d 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1285,6 +1285,26 @@ end
assert_equal @spec, installer.install
end
+ def test_install_build_root_when_gem_home_not_writable_does_not_fallback_to_user_install_inside_build_root
+ build_root = File.join(@tempdir, "build_root")
+
+ orig_gem_home = ENV.delete("GEM_HOME")
+
+ @gem = setup_base_gem
+
+ FileUtils.chmod "-w", @gemhome
+
+ installer = Gem::Installer.at @gem, :build_root => build_root
+
+ assert_equal @spec, installer.install
+
+ build_root_path = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""))
+ assert File.exist?(build_root_path), "gem not written to build_root"
+ ensure
+ FileUtils.chmod "+w", @gemhome
+ ENV["GEM_HOME"] = orig_gem_home
+ end
+
def test_install_missing_dirs
installer = setup_base_installer