From a0093092fc67a7cc0bfb97788a2ca1f31ce06e06 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 19 Mar 2026 08:58:31 +0900 Subject: [PATCH] [ruby/rubygems] Default RGV to "." and add switch_rubygems to bin/rspec With spec/ at the repo root, rspec auto-adds lib/ to $LOAD_PATH, which now points to the repo's rubygems lib instead of bundler's lib. This causes a conflict between system and local rubygems. Adding switch_rubygems ensures a clean local rubygems load from the start. Also default RGV to "." so no environment variables are needed to run bin/rspec or bin/parallel_rspec. https://github.com/ruby/rubygems/commit/b4774e3aab Co-Authored-By: Claude Opus 4.6 (1M context) --- spec/bin/rspec | 1 + spec/bundler/support/switch_rubygems.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/bin/rspec b/spec/bin/rspec index 1f61e3c64c..a41aa4896a 100755 --- a/spec/bin/rspec +++ b/spec/bin/rspec @@ -1,6 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true +require_relative "../bundler/support/switch_rubygems" require_relative "../bundler/support/rubygems_ext" Spec::Rubygems.gem_load("rspec-core", "rspec") diff --git a/spec/bundler/support/switch_rubygems.rb b/spec/bundler/support/switch_rubygems.rb index a138d22333..640b9f83b7 100644 --- a/spec/bundler/support/switch_rubygems.rb +++ b/spec/bundler/support/switch_rubygems.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true require_relative "rubygems_version_manager" +ENV["RGV"] ||= "." RubygemsVersionManager.new(ENV["RGV"]).switch