[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) <noreply@anthropic.com>
This commit is contained in:
Hiroshi SHIBATA 2026-03-19 08:58:31 +09:00
parent e2696ded47
commit a0093092fc
Notes: git 2026-03-23 08:25:52 +00:00
2 changed files with 2 additions and 0 deletions

View File

@ -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")

View File

@ -1,4 +1,5 @@
# frozen_string_literal: true
require_relative "rubygems_version_manager"
ENV["RGV"] ||= "."
RubygemsVersionManager.new(ENV["RGV"]).switch