summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-03-10 18:53:00 +0100
committerHiroshi SHIBATA <[email protected]>2025-03-12 18:02:09 +0900
commit13020ac0696819f1e996c9a1998f782f624e5903 (patch)
treea415b15e5c0bc5944546326daad754a92f1429ab /spec
parent51958bae66df026823fff159dd7513daf74f5727 (diff)
[rubygems/rubygems] Path helper to build paths in compact index cache
https://github.com/rubygems/rubygems/commit/d28f9b8515
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb14
-rw-r--r--spec/bundler/support/path.rb4
2 files changed, 9 insertions, 9 deletions
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 4274172772..e7322ab5ad 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -183,8 +183,7 @@ RSpec.describe "compact index api" do
gem "myrack"
G
- versions = Pathname.new(Bundler.rubygems.user_home).join(
- ".bundle", "cache", "compact_index",
+ versions = compact_index_cache_path.join(
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
)
versions.dirname.mkpath
@@ -789,8 +788,7 @@ RSpec.describe "compact index api" do
end
it "performs update with etag not-modified" do
- versions_etag = Pathname.new(Bundler.rubygems.user_home).join(
- ".bundle", "cache", "compact_index",
+ versions_etag = compact_index_cache_path.join(
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions.etag"
)
expect(versions_etag.file?).to eq(false)
@@ -833,8 +831,7 @@ RSpec.describe "compact index api" do
gem 'myrack', '1.0.0'
G
- versions = Pathname.new(Bundler.rubygems.user_home).join(
- ".bundle", "cache", "compact_index",
+ versions = compact_index_cache_path.join(
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
)
# Modify the cached file. The ranged request will be based on this but,
@@ -876,8 +873,7 @@ RSpec.describe "compact index api" do
G
# Create a partial cache versions file
- versions = Pathname.new(Bundler.rubygems.user_home).join(
- ".bundle", "cache", "compact_index",
+ versions = compact_index_cache_path.join(
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
)
versions.dirname.mkpath
@@ -941,7 +937,7 @@ RSpec.describe "compact index api" do
bundle :install, artifice: "compact_index"
- cache_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5")
+ cache_path = compact_index_cache_path.join("localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5")
# We must remove the etag so that we don't ignore the range and get a 304 Not Modified.
myrack_info_etag_path = File.join(cache_path, "info-etags", "myrack-92f3313ce5721296f14445c3a6b9c073")
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 6c63666519..9b67ab0229 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -143,6 +143,10 @@ module Spec
end
end
+ def compact_index_cache_path
+ home(".bundle/cache/compact_index")
+ end
+
def bundled_app(*path)
root = tmp("bundled_app")
FileUtils.mkdir_p(root)