From 71b937d3d7f1369a55844201f31720e815d0168c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 21 Aug 2021 16:52:48 +0200 Subject: [PATCH] [rubygems/rubygems] Normalize setting `GEM_PATH` https://github.com/rubygems/rubygems/commit/4188ebd568 --- lib/bundler.rb | 4 ++-- spec/bundler/bundler/bundler_spec.rb | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/bundler.rb b/lib/bundler.rb index 47f1fd248c..52e80c4baf 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -661,12 +661,12 @@ EOF configure_gem_home end - def configure_gem_path(env = ENV) + def configure_gem_path unless use_system_gems? # this needs to be empty string to cause # PathSupport.split_gem_path to only load up the # Bundler --path setting as the GEM_PATH. - env["GEM_PATH"] = "" + Bundler::SharedHelpers.set_env "GEM_PATH", "" end end diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb index d164b5d3c6..b8191fe20f 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb @@ -176,11 +176,9 @@ RSpec.describe Bundler do describe "configuration" do context "disable_shared_gems" do it "should unset GEM_PATH with empty string" do - env = {} expect(Bundler).to receive(:use_system_gems?).and_return(false) - Bundler.send(:configure_gem_path, env) - expect(env.keys).to include("GEM_PATH") - expect(env["GEM_PATH"]).to eq "" + Bundler.send(:configure_gem_path) + expect(ENV["GEM_PATH"]).to eq "" end end end