diff options
author | Martin Emde <[email protected]> | 2023-08-30 15:15:52 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-10-23 13:59:01 +0900 |
commit | 92f23a48e3bb7555ca99fc49e15b250a70f9d086 (patch) | |
tree | bd583abe4555696c8b68d141f7f51d8755b2e96e /spec/bundler/install | |
parent | c5fd94073ff2e22b6eea29c242c7e4a12ed7c865 (diff) |
[rubygems/rubygems] Refactor Checksum classes and methods to reduce
code.
(https://github.com/rubygems/rubygems/pull/6917)
https://github.com/rubygems/rubygems/commit/2238bdaadc
Diffstat (limited to 'spec/bundler/install')
-rw-r--r-- | spec/bundler/install/gemfile/gemspec_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/install_if_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/path_spec.rb | 30 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/platform_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/sources_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/specific_platform_spec.rb | 18 | ||||
-rw-r--r-- | spec/bundler/install/gems/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/yanked_spec.rb | 4 |
8 files changed, 41 insertions, 41 deletions
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index da8b6a90b1..f1e68bbec1 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -449,7 +449,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "platform_specific", "1.0" c.repo_gem gem_repo2, "platform_specific", "1.0", "java" c.repo_gem gem_repo2, "platform_specific", "1.0", x64_mingw32 @@ -493,7 +493,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "platform_specific", "1.0" c.repo_gem gem_repo2, "platform_specific", "1.0", "java" c.repo_gem gem_repo2, "platform_specific", "1.0", x64_mingw32 @@ -538,7 +538,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "indirect_platform_specific", "1.0" c.repo_gem gem_repo2, "platform_specific", "1.0" c.repo_gem gem_repo2, "platform_specific", "1.0", "java" diff --git a/spec/bundler/install/gemfile/install_if_spec.rb b/spec/bundler/install/gemfile/install_if_spec.rb index ced6f42d79..c8ddb685ff 100644 --- a/spec/bundler/install/gemfile/install_if_spec.rb +++ b/spec/bundler/install/gemfile/install_if_spec.rb @@ -39,9 +39,9 @@ RSpec.describe "bundle install with install_if conditionals" do CHECKSUMS #{checksum_for_repo_gem gem_repo1, "activesupport", "2.3.5"} - #{checksum_for_repo_gem gem_repo1, "foo", "1.0", :empty => true} + #{gem_no_checksum "foo", "1.0"} #{checksum_for_repo_gem gem_repo1, "rack", "1.0.0"} - #{checksum_for_repo_gem gem_repo1, "thin", "1.0", :empty => true} + #{gem_no_checksum "thin", "1.0"} BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index 5d0c759f4e..3af8412eab 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -121,8 +121,8 @@ RSpec.describe "bundle install with explicit source paths" do demo! CHECKSUMS - aaa (1.0) - demo (1.0) + #{gem_no_checksum("aaa", "1.0")} + #{gem_no_checksum("demo", "1.0")} BUNDLED WITH #{Bundler::VERSION} @@ -364,8 +364,8 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (0.1.0) - #{checksum_for_repo_gem gem_repo4, "graphql", "2.0.15"} + #{gem_no_checksum("foo", "0.1.0")} + #{checksum_for_repo_gem(gem_repo4, "graphql", "2.0.15")} BUNDLED WITH #{Bundler::VERSION} @@ -692,8 +692,8 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (1.0) - #{checksum_for_repo_gem gem_repo1, "rack", "0.9.1"} + #{gem_no_checksum("foo", "1.0")} + #{checksum_for_repo_gem(gem_repo1, "rack", "0.9.1")} BUNDLED WITH #{Bundler::VERSION} @@ -724,8 +724,8 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (1.0) - #{checksum_for_repo_gem gem_repo1, "rack", "0.9.1"} + #{gem_no_checksum("foo", "1.0")} + #{checksum_for_repo_gem(gem_repo1, "rack", "0.9.1")} BUNDLED WITH #{Bundler::VERSION} @@ -762,8 +762,8 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (1.0) - #{checksum_for_repo_gem gem_repo1, "rack", "0.9.1"} + #{gem_no_checksum("foo", "1.0")} + #{checksum_for_repo_gem(gem_repo1, "rack", "0.9.1")} BUNDLED WITH #{Bundler::VERSION} @@ -797,9 +797,9 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (1.0) - #{checksum_for_repo_gem gem_repo1, "rack", "0.9.1"} - #{checksum_for_repo_gem gem_repo1, "rake", "13.0.1"} + #{gem_no_checksum("foo", "1.0")} + #{checksum_for_repo_gem(gem_repo1, "rack", "0.9.1")} + #{checksum_for_repo_gem(gem_repo1, "rake", "13.0.1")} BUNDLED WITH #{Bundler::VERSION} @@ -850,8 +850,8 @@ RSpec.describe "bundle install with explicit source paths" do foo! CHECKSUMS - foo (1.0) - rack (0.9.1) + #{gem_no_checksum("foo", "1.0")} + #{gem_no_checksum("rack", "0.9.1")} BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index bb62558deb..918a49e1e1 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -426,7 +426,7 @@ RSpec.describe "bundle install across platforms" do CHECKSUMS #{checksum_for_repo_gem(gem_repo1, "platform_specific", "1.0")} - #{checksum_for_repo_gem(gem_repo1, "platform_specific", "1.0", "java", :empty => true)} + #{gem_no_checksum "platform_specific", "1.0", "java"} BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 318b4907df..72658aebd9 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -284,7 +284,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo2") - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo3, "depends_on_rack", "1.0.1" c.repo_gem gem_repo2, "rack", "1.0.0" end @@ -706,7 +706,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("concurrent-ruby 1.1.8") expect(the_bundle).not_to include_gems("concurrent-ruby 1.1.9") - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "activesupport", "6.0.3.4" c.repo_gem gem_repo2, "concurrent-ruby", "1.1.8" c.repo_gem gem_repo2, "connection_pool", "2.2.3" @@ -809,7 +809,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).not_to include_gems("concurrent-ruby 1.1.8") expect(the_bundle).to include_gems("concurrent-ruby 1.1.9") - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "activesupport", "6.1.2.1" c.repo_gem gem_repo2, "concurrent-ruby", "1.1.9" c.repo_gem gem_repo2, "connection_pool", "2.2.3" @@ -881,7 +881,7 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(the_bundle).to include_gems("concurrent-ruby 1.1.9") expect(the_bundle).not_to include_gems("concurrent-ruby 1.1.8") - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "activesupport", "6.0.3.4" c.repo_gem gem_repo2, "concurrent-ruby", "1.1.9" c.repo_gem gem_repo2, "connection_pool", "2.2.3" @@ -1006,7 +1006,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the default source without any warnings or errors and generates a proper lockfile" do - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo3, "handsoap", "0.2.5.5" c.repo_gem gem_repo2, "nokogiri", "1.11.1" c.repo_gem gem_repo2, "racca", "1.5.2" @@ -1567,7 +1567,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "upgrades the lockfile correctly" do bundle "lock --update", :artifice => "compact_index" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo2, "capybara", "2.5.0" c.repo_gem gem_repo4, "mime-types", "3.0.0" end @@ -1686,7 +1686,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "handles that fine" do bundle "install", :artifice => "compact_index_extra", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo4, "pdf-writer", "1.1.8" c.repo_gem gem_repo2, "ruport", "1.7.0.3" end @@ -1741,7 +1741,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "handles that fine" do bundle "install --verbose", :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo4, "pdf-writer", "1.1.8" end diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index 6ec236b0c8..cb6b18cda2 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -528,7 +528,7 @@ RSpec.describe "bundle install with specific platforms" do bundle "update" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo4, "sorbet", "0.5.10160" c.repo_gem gem_repo4, "sorbet-runtime", "0.5.10160" c.repo_gem gem_repo4, "sorbet-static", "0.5.10160", Gem::Platform.local @@ -626,8 +626,8 @@ RSpec.describe "bundle install with specific platforms" do sorbet-static CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.0", "x86_64-darwin", :empty => true} - #{checksum_for_repo_gem gem_repo4, "sorbet-static", "0.5.10601", "x86_64-darwin", :empty => true} + #{gem_no_checksum "nokogiri", "1.13.0", "x86_64-darwin"} + #{gem_no_checksum "sorbet-static", "0.5.10601", "x86_64-darwin"} BUNDLED WITH #{Bundler::VERSION} @@ -682,7 +682,7 @@ RSpec.describe "bundle install with specific platforms" do bundle "update" - expected_checksums = construct_checksum_section do |c| + expected_checksums = checksum_section do |c| c.repo_gem gem_repo4, "sorbet", "0.5.10160" c.repo_gem gem_repo4, "sorbet-runtime", "0.5.10160" c.repo_gem gem_repo4, "sorbet-static", "0.5.10160", Gem::Platform.local @@ -836,7 +836,7 @@ RSpec.describe "bundle install with specific platforms" do CHECKSUMS #{checksum_for_repo_gem gem_repo4, "sorbet-static", "0.5.10549", "universal-darwin-20"} - #{checksum_for_repo_gem gem_repo4, "sorbet-static", "0.5.10549", "universal-darwin-21", :empty => true} + #{gem_no_checksum "sorbet-static", "0.5.10549", "universal-darwin-21"} BUNDLED WITH #{Bundler::VERSION} @@ -899,8 +899,8 @@ RSpec.describe "bundle install with specific platforms" do tzinfo (~> 1.2) CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.8", :empty => true} - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.8", Gem::Platform.local, :empty => true} + #{gem_no_checksum "nokogiri", "1.13.8"} + #{gem_no_checksum "nokogiri", "1.13.8", Gem::Platform.local} BUNDLED WITH #{Bundler::VERSION} @@ -955,8 +955,8 @@ RSpec.describe "bundle install with specific platforms" do rack CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "concurrent-ruby", "1.2.2", :empty => true} - #{checksum_for_repo_gem gem_repo4, "rack", "3.0.7", :empty => true} + #{gem_no_checksum "concurrent-ruby", "1.2.2"} + #{gem_no_checksum "rack", "3.0.7"} BUNDLED WITH #{Bundler::VERSION} diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index f723c0da73..4a345824ce 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -882,7 +882,7 @@ The checksum of /versions does not match the checksum provided by the server! So gem "rack" G - api_checksum = Spec::Checksums::ChecksumsBuilder.new.repo_gem(gem_repo1, "rack", "1.0.0").first.checksums.fetch("sha256") + api_checksum = checksum_for_repo_gem(gem_repo1, "rack", "1.0.0").split("sha256-").last gem_path = if Bundler.feature_flag.global_gem_cache? default_cache_path.dirname.join("cache", "gems", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "rack-1.0.0.gem") diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb index a84772fa78..338a187472 100644 --- a/spec/bundler/install/yanked_spec.rb +++ b/spec/bundler/install/yanked_spec.rb @@ -161,8 +161,8 @@ RSpec.context "when resolving a bundle that includes yanked gems, but unlocking foo CHECKSUMS - #{checksum_for_repo_gem(gem_repo4, "bar", "2.0.0", :empty => true)} - #{checksum_for_repo_gem(gem_repo4, "foo", "9.0.0", :empty => true)} + #{gem_no_checksum "bar", "2.0.0"} + #{gem_no_checksum "foo", "9.0.0"} BUNDLED WITH #{Bundler::VERSION} |