summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrey Baker <greysteil@gmail.com>2017-07-05 15:38:03 +0100
committerGrey Baker <greysteil@gmail.com>2017-07-05 15:38:03 +0100
commit4f863d5dbf51dd78d05c28170ee2e638c2734529 (patch)
treeffad8137f36d620ebb94f60909d78067631e269f
parent0c065f5ba63170badd4f57baab9940c59a50e50b (diff)
downloadbundler-4f863d5dbf51dd78d05c28170ee2e638c2734529.tar.gz
Make CompactIndexPartialUpdate artifice deterministic
-rw-r--r--spec/support/artifice/compact_index_partial_update.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/spec/support/artifice/compact_index_partial_update.rb b/spec/support/artifice/compact_index_partial_update.rb
index d95941eae6..bf6feab877 100644
--- a/spec/support/artifice/compact_index_partial_update.rb
+++ b/spec/support/artifice/compact_index_partial_update.rb
@@ -11,26 +11,25 @@ class CompactIndexPartialUpdate < CompactIndexAPI
end
get "/versions" do
- versions = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index",
- "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions")
+ cached_versions_path = File.join(
+ Bundler.rubygems.user_home, ".bundle", "cache", "compact_index",
+ "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
+ )
# Verify a cached copy of the versions file exists
- unless File.read(versions).start_with?("created_at: ")
+ unless File.read(cached_versions_path).start_with?("created_at: ")
raise("Cached versions file should be present and have content")
end
# Verify that a partial request is made, starting from the index of the
# final byte of the cached file.
- unless env["HTTP_RANGE"] == "bytes=#{File.read(versions).bytesize - 1}-"
+ unless env["HTTP_RANGE"] == "bytes=#{File.read(cached_versions_path).bytesize - 1}-"
raise("Range header should be present, and start from the index of the final byte of the cache.")
end
etag_response do
- file = tmp("versions.list")
- file.delete if file.file?
- file = CompactIndex::VersionsFile.new(file.to_s)
- file.create(gems)
- file.contents
+ # Return the exact contents of the cache.
+ File.read(cached_versions_path)
end
end
end