summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Panozzo <panozzaj@gmail.com>2026-01-07 13:04:57 -0500
committergit <svn-admin@ruby-lang.org>2026-02-12 17:06:38 +0000
commit104c8be99cac15810456577ca14f9c2887c1c5d7 (patch)
tree06f3c42f4303a65f99c45e8d320b8a7abc4918e1
parente59dd8fe0536e630ab0fb053212f80b34c2d3099 (diff)
[ruby/rubygems] Fix global_cache_spec to work with system RubyGems
When running Bundler tests against system RubyGems (which doesn't have Gem.global_gem_cache_path), the test needs to use the fallback cache location (~/.bundle/cache/gems/) that Bundler uses in that case. https://github.com/ruby/rubygems/commit/a6fc1d862b
-rw-r--r--spec/bundler/install/global_cache_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb
index 5378636182..77ab94609e 100644
--- a/spec/bundler/install/global_cache_spec.rb
+++ b/spec/bundler/install/global_cache_spec.rb
@@ -8,7 +8,13 @@ RSpec.describe "global gem caching" do
let(:source2) { "http://gemserver.example.org" }
def cache_base
- home(".cache", "gem", "gems")
+ # Use the unified global gem cache path if available (from RubyGems),
+ # otherwise fall back to the Bundler-specific cache location
+ if Gem.respond_to?(:global_gem_cache_path)
+ Pathname.new(Gem.global_gem_cache_path)
+ else
+ home(".bundle", "cache", "gems")
+ end
end
def source_global_cache(*segments)