diff options
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r-- | spec/bundler/commands/check_spec.rb | 25 | ||||
-rw-r--r-- | spec/bundler/commands/install_spec.rb | 43 | ||||
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 264 | ||||
-rw-r--r-- | spec/bundler/commands/update_spec.rb | 97 |
4 files changed, 218 insertions, 211 deletions
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index dacbd6c45f..ca6a7d1e27 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -406,6 +406,12 @@ RSpec.describe "bundle check" do it "returns success when the Gemfile is satisfied and generates a correct lockfile" do system_gems "depends_on_rack-1.0", "rack-1.0", :gem_repo => gem_repo4, :path => default_bundle_path bundle :check + + checksums = checksums_section_when_existing do |c| + c.no_checksum "depends_on_rack", "1.0" + c.no_checksum "rack", "1.0" + end + expect(out).to include("The Gemfile's dependencies are satisfied") expect(lockfile).to eq <<~L GEM @@ -424,11 +430,7 @@ RSpec.describe "bundle check" do DEPENDENCIES depends_on_rack! - - CHECKSUMS - depends_on_rack (1.0) - rack (1.0) - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -468,6 +470,12 @@ RSpec.describe "bundle check" do bundle "check --verbose", :dir => tmp.join("bundle-check-issue") + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "awesome_print", "1.0" + c.no_checksum "bundle-check-issue", "9999" + c.checksum gem_repo2, "dex-dispatch-engine", "1.0" + end + expect(File.read(tmp.join("bundle-check-issue/Gemfile.lock"))).to eq <<~L PATH remote: . @@ -491,12 +499,7 @@ RSpec.describe "bundle check" do DEPENDENCIES bundle-check-issue! dex-dispatch-engine! - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "awesome_print", "1.0"} - bundle-check-issue (9999) - #{checksum_for_repo_gem gem_repo2, "dex-dispatch-engine", "1.0"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index d570bac44a..66b618c2b1 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -622,6 +622,7 @@ RSpec.describe "bundle install with gem sources" do end it "writes current Ruby version to Gemfile.lock" do + checksums = checksums_section_when_existing expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo1)}/ @@ -631,9 +632,7 @@ RSpec.describe "bundle install with gem sources" do #{lockfile_platforms} DEPENDENCIES - - CHECKSUMS - + #{checksums} RUBY VERSION #{Bundler::RubyVersion.system} @@ -648,6 +647,8 @@ RSpec.describe "bundle install with gem sources" do source "#{file_uri_for(gem_repo1)}" G + checksums = checksums_section_when_existing + expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo1)}/ @@ -657,9 +658,7 @@ RSpec.describe "bundle install with gem sources" do #{lockfile_platforms} DEPENDENCIES - - CHECKSUMS - + #{checksums} RUBY VERSION #{Bundler::RubyVersion.system} @@ -1074,11 +1073,11 @@ RSpec.describe "bundle install with gem sources" do gem "loofah", "~> 2.12.0" G - checksums = checksum_section do |c| - c.repo_gem gem_repo4, "crass", "1.0.6" - c.repo_gem gem_repo4, "loofah", "2.12.0" - c.repo_gem gem_repo4, "nokogiri", "1.12.4", "x86_64-darwin" - c.repo_gem gem_repo4, "racca", "1.5.2" + checksums = checksums_section do |c| + c.checksum gem_repo4, "crass", "1.0.6" + c.checksum gem_repo4, "loofah", "2.12.0" + c.checksum gem_repo4, "nokogiri", "1.12.4", "x86_64-darwin" + c.checksum gem_repo4, "racca", "1.5.2" end lockfile <<-L @@ -1099,10 +1098,7 @@ RSpec.describe "bundle install with gem sources" do DEPENDENCIES loofah (~> 2.12.0) - - CHECKSUMS - #{checksums} - + #{checksums} RUBY VERSION #{Bundler::RubyVersion.system} @@ -1118,12 +1114,12 @@ RSpec.describe "bundle install with gem sources" do bundle "install", :artifice => "compact_index" end - expected_checksums = checksum_section do |c| - c.repo_gem gem_repo4, "crass", "1.0.6" - c.repo_gem gem_repo4, "loofah", "2.12.0" - c.repo_gem gem_repo4, "nokogiri", "1.12.4", "x86_64-darwin" - c.repo_gem gem_repo4, "nokogiri", "1.12.4", "x86_64-linux" - c.repo_gem gem_repo4, "racca", "1.5.2" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "crass", "1.0.6" + c.checksum gem_repo4, "loofah", "2.12.0" + c.checksum gem_repo4, "nokogiri", "1.12.4", "x86_64-darwin" + c.checksum gem_repo4, "racca", "1.5.2" + c.checksum gem_repo4, "nokogiri", "1.12.4", "x86_64-linux" end expect(lockfile).to eq <<~L @@ -1146,10 +1142,7 @@ RSpec.describe "bundle install with gem sources" do DEPENDENCIES loofah (~> 2.12.0) - - CHECKSUMS - #{expected_checksums} - + #{checksums} RUBY VERSION #{Bundler::RubyVersion.system} diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index 5c6a2c0e3d..e4d44f09f5 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -11,16 +11,16 @@ RSpec.describe "bundle lock" do gem "foo" G - expected_checksums = checksum_section do |c| - c.repo_gem repo, "actionmailer", "2.3.2" - c.repo_gem repo, "actionpack", "2.3.2" - c.repo_gem repo, "activerecord", "2.3.2" - c.repo_gem repo, "activeresource", "2.3.2" - c.repo_gem repo, "activesupport", "2.3.2" - c.repo_gem repo, "foo", "1.0" - c.repo_gem repo, "rails", "2.3.2" - c.repo_gem repo, "rake", "13.0.1" - c.repo_gem repo, "weakling", "0.0.3" + checksums = checksums_section_when_existing do |c| + c.checksum repo, "actionmailer", "2.3.2" + c.checksum repo, "actionpack", "2.3.2" + c.checksum repo, "activerecord", "2.3.2" + c.checksum repo, "activeresource", "2.3.2" + c.checksum repo, "activesupport", "2.3.2" + c.checksum repo, "foo", "1.0" + c.checksum repo, "rails", "2.3.2" + c.checksum repo, "rake", "13.0.1" + c.checksum repo, "weakling", "0.0.3" end @lockfile = <<~L @@ -53,10 +53,7 @@ RSpec.describe "bundle lock" do foo rails weakling - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -65,12 +62,18 @@ RSpec.describe "bundle lock" do it "prints a lockfile when there is no existing lockfile with --print" do bundle "lock --print" - # No checksums because no way to get them from a file uri source - # + no existing lockfile that has them - expect(out).to eq(remove_checksums_from_lockfile(@lockfile.chomp)) + expect(out).to eq(@lockfile.chomp) end it "prints a lockfile when there is an existing lockfile with --print" do + lockfile remove_checksums_section_from_lockfile(@lockfile) + + bundle "lock --print" + + expect(out).to eq(remove_checksums_section_from_lockfile(@lockfile).chomp) + end + + it "prints a lockfile when there is an existing checksums lockfile with --print" do lockfile @lockfile bundle "lock --print" @@ -81,26 +84,39 @@ RSpec.describe "bundle lock" do it "writes a lockfile when there is no existing lockfile" do bundle "lock" - # No checksums because no way to get them from a file uri source - # + no existing lockfile that has them - expect(read_lockfile).to eq(remove_checksums_from_lockfile(@lockfile)) + expect(read_lockfile).to eq(@lockfile) + end + + it "prints a lockfile without fetching new checksums if the existing lockfile had no checksums" do + lockfile remove_checksums_from_lockfile(@lockfile) + + bundle "lock --print" + + expect(out).to eq(remove_checksums_from_lockfile(@lockfile).chomp) end it "writes a lockfile when there is an outdated lockfile using --update" do + lockfile remove_checksums_from_lockfile(@lockfile.gsub("2.3.2", "2.3.1"), " (2.3.1)") + + bundle "lock --update" + + expect(read_lockfile).to eq(remove_checksums_from_lockfile(@lockfile)) + end + + it "writes a lockfile with checksums on --update when checksums exist" do lockfile @lockfile.gsub("2.3.2", "2.3.1") bundle "lock --update" - expect(read_lockfile).to eq(remove_checksums_from_lockfile(@lockfile, "(2.3.2)")) + expect(read_lockfile).to eq(@lockfile) end - it "writes a lockfile when there is an outdated lockfile using a bundle is frozen" do + it "writes a lockfile when there is an outdated lockfile and bundle is frozen" do lockfile @lockfile.gsub("2.3.2", "2.3.1") bundle "lock --update", :env => { "BUNDLE_FROZEN" => "true" } - # No checksums for the updated gems - expect(read_lockfile).to eq(remove_checksums_from_lockfile(@lockfile, "(2.3.2)")) + expect(read_lockfile).to eq(@lockfile) end it "does not fetch remote specs when using the --local option" do @@ -109,11 +125,24 @@ RSpec.describe "bundle lock" do expect(err).to match(/locally installed gems/) end + it "does not fetch remote checksums with --local" do + lockfile remove_checksums_from_lockfile(@lockfile) + + bundle "lock --print --local" + + # No checksums because --local prevents fetching them + expect(out).to eq(remove_checksums_from_lockfile(@lockfile).chomp) + end + it "works with --gemfile flag" do create_file "CustomGemfile", <<-G source "#{file_uri_for(repo)}" gem "foo" G + checksums = checksums_section_when_existing do |c| + c.no_checksum "foo", "1.0" + end + lockfile = <<~L GEM remote: #{file_uri_for(repo)}/ @@ -125,10 +154,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES foo - - CHECKSUMS - #{gem_no_checksum "foo", "1.0"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -151,16 +177,16 @@ RSpec.describe "bundle lock" do bundle "install" bundle "lock --lockfile=lock" - expected_checksums = checksum_section do |c| - c.repo_gem repo, "actionmailer", "2.3.2" - c.repo_gem repo, "actionpack", "2.3.2" - c.repo_gem repo, "activerecord", "2.3.2" - c.repo_gem repo, "activeresource", "2.3.2" - c.repo_gem repo, "activesupport", "2.3.2" - c.repo_gem repo, "foo", "1.0" - c.repo_gem repo, "rails", "2.3.2" - c.repo_gem repo, "rake", "13.0.1" - c.repo_gem repo, "weakling", "0.0.3" + checksums = checksums_section_when_existing do |c| + c.checksum repo, "actionmailer", "2.3.2" + c.checksum repo, "actionpack", "2.3.2" + c.checksum repo, "activerecord", "2.3.2" + c.checksum repo, "activeresource", "2.3.2" + c.checksum repo, "activesupport", "2.3.2" + c.checksum repo, "foo", "1.0" + c.checksum repo, "rails", "2.3.2" + c.checksum repo, "rake", "13.0.1" + c.checksum repo, "weakling", "0.0.3" end lockfile = <<~L @@ -193,10 +219,7 @@ RSpec.describe "bundle lock" do foo rails weakling - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -510,6 +533,11 @@ RSpec.describe "bundle lock" do end end + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.12.0" + c.checksum gem_repo4, "nokogiri", "1.12.0", "x86_64-darwin" + end + simulate_platform "x86_64-darwin-22" do install_gemfile <<~G source "#{file_uri_for(gem_repo4)}" @@ -531,15 +559,13 @@ RSpec.describe "bundle lock" do DEPENDENCIES nokogiri - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.12.0"} - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.12.0", "x86_64-darwin"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L + checksums.delete("nokogiri", Gem::Platform::RUBY) + simulate_platform "x86_64-darwin-22" do bundle "lock --remove-platform ruby" end @@ -555,10 +581,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES nokogiri - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.12.0", "x86_64-darwin"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -606,6 +629,13 @@ RSpec.describe "bundle lock" do gem "gssapi" G + checksums = checksums_section_when_existing do |c| + c.no_checksum "ffi", "1.9.14", "x86-mingw32" + c.no_checksum "gssapi", "1.2.0" + c.no_checksum "mixlib-shellout", "2.2.6", "universal-mingw32" + c.no_checksum "win32-process", "0.8.3" + end + simulate_platform(x86_mingw32) { bundle :lock } expect(lockfile).to eq <<~G @@ -626,13 +656,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES gssapi mixlib-shellout - - CHECKSUMS - #{gem_no_checksum "ffi", "1.9.14", "x86-mingw32"} - #{gem_no_checksum "gssapi", "1.2.0"} - #{gem_no_checksum "mixlib-shellout", "2.2.6", "universal-mingw32"} - #{gem_no_checksum "win32-process", "0.8.3"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} G @@ -640,6 +664,9 @@ RSpec.describe "bundle lock" do bundle "config set --local force_ruby_platform true" bundle :lock + checksums.no_checksum "ffi", "1.9.14" + checksums.no_checksum "mixlib-shellout", "2.2.6" + expect(lockfile).to eq <<~G GEM remote: #{file_uri_for(gem_repo4)}/ @@ -661,15 +688,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES gssapi mixlib-shellout - - CHECKSUMS - #{gem_no_checksum "ffi", "1.9.14"} - #{gem_no_checksum "ffi", "1.9.14", "x86-mingw32"} - #{gem_no_checksum "gssapi", "1.2.0"} - #{gem_no_checksum "mixlib-shellout", "2.2.6"} - #{gem_no_checksum "mixlib-shellout", "2.2.6", "universal-mingw32"} - #{gem_no_checksum "win32-process", "0.8.3"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} G @@ -735,6 +754,11 @@ RSpec.describe "bundle lock" do simulate_platform(Gem::Platform.new("x86_64-darwin-19")) { bundle "lock" } + checksums = checksums_section_when_existing do |c| + c.no_checksum "libv8", "8.4.255.0", "x86_64-darwin-19" + c.no_checksum "libv8", "8.4.255.0", "x86_64-darwin-20" + end + expect(lockfile).to eq <<~G GEM remote: #{file_uri_for(gem_repo4)}/ @@ -748,11 +772,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES libv8 - - CHECKSUMS - #{gem_no_checksum "libv8", "8.4.255.0", "x86_64-darwin-19"} - #{gem_no_checksum "libv8", "8.4.255.0", "x86_64-darwin-20"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} G @@ -769,6 +789,11 @@ RSpec.describe "bundle lock" do end end + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "libv8", "8.4.255.0", "x86_64-darwin-19" + c.checksum gem_repo4, "libv8", "8.4.255.0", "x86_64-darwin-20" + end + gemfile <<-G source "#{file_uri_for(gem_repo4)}" @@ -787,11 +812,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES libv8 - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "libv8", "8.4.255.0", "x86_64-darwin-19"} - #{checksum_for_repo_gem gem_repo4, "libv8", "8.4.255.0", "x86_64-darwin-20"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} G @@ -960,16 +981,16 @@ RSpec.describe "bundle lock" do it "does not implicitly update" do bundle "lock" - expected_checksums = checksum_section do |c| - c.repo_gem repo, "actionmailer", "2.3.2" - c.repo_gem repo, "actionpack", "2.3.2" - c.repo_gem repo, "activerecord", "2.3.2" - c.repo_gem repo, "activeresource", "2.3.2" - c.repo_gem repo, "activesupport", "2.3.2" - c.repo_gem repo, "foo", "1.0" - c.repo_gem repo, "rails", "2.3.2" - c.repo_gem repo, "rake", "13.0.1" - c.repo_gem repo, "weakling", "0.0.3" + checksums = checksums_section_when_existing do |c| + c.checksum repo, "actionmailer", "2.3.2" + c.checksum repo, "actionpack", "2.3.2" + c.checksum repo, "activerecord", "2.3.2" + c.checksum repo, "activeresource", "2.3.2" + c.checksum repo, "activesupport", "2.3.2" + c.checksum repo, "foo", "1.0" + c.checksum repo, "rails", "2.3.2" + c.checksum repo, "rake", "13.0.1" + c.checksum repo, "weakling", "0.0.3" end expected_lockfile = <<~L @@ -1002,10 +1023,7 @@ RSpec.describe "bundle lock" do foo rails weakling - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1017,16 +1035,16 @@ RSpec.describe "bundle lock" do gemfile gemfile.gsub('"foo"', '"foo", "2.0"') bundle "lock" - expected_checksums = checksum_section do |c| - c.repo_gem repo, "actionmailer", "2.3.2" - c.repo_gem repo, "actionpack", "2.3.2" - c.repo_gem repo, "activerecord", "2.3.2" - c.repo_gem repo, "activeresource", "2.3.2" - c.repo_gem repo, "activesupport", "2.3.2" + checksums = checksums_section_when_existing do |c| + c.checksum repo, "actionmailer", "2.3.2" + c.checksum repo, "actionpack", "2.3.2" + c.checksum repo, "activerecord", "2.3.2" + c.checksum repo, "activeresource", "2.3.2" + c.checksum repo, "activesupport", "2.3.2" c.no_checksum "foo", "2.0" - c.repo_gem repo, "rails", "2.3.2" - c.repo_gem repo, "rake", "13.0.1" - c.repo_gem repo, "weakling", "0.0.3" + c.checksum repo, "rails", "2.3.2" + c.checksum repo, "rake", "13.0.1" + c.checksum repo, "weakling", "0.0.3" end expected_lockfile = <<~L @@ -1059,10 +1077,7 @@ RSpec.describe "bundle lock" do foo (= 2.0) rails weakling - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1111,9 +1126,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES debug - - CHECKSUMS - + #{checksums_section} BUNDLED WITH #{Bundler::VERSION} L @@ -1122,6 +1135,11 @@ RSpec.describe "bundle lock" do bundle "lock" end + checksums = checksums_section do |c| + c.no_checksum "debug", "1.6.3" + c.no_checksum "irb", "1.5.0" + end + expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -1136,11 +1154,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES debug - - CHECKSUMS - #{gem_no_checksum "debug", "1.6.3"} - #{gem_no_checksum "irb", "1.5.0"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1422,6 +1436,11 @@ RSpec.describe "bundle lock" do end it "locks ruby specs" do + checksums = checksums_section_when_existing do |c| + c.no_checksum "foo", "1.0" + c.no_checksum "nokogiri", "1.14.2" + end + simulate_platform "x86_64-linux" do bundle "lock" end @@ -1443,11 +1462,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES foo! - - CHECKSUMS - #{gem_no_checksum "foo", "1.0"} - #{gem_no_checksum "nokogiri", "1.14.2"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1508,6 +1523,13 @@ RSpec.describe "bundle lock" do end it "does not downgrade top level dependencies" do + checksums = checksums_section_when_existing do |c| + c.no_checksum "actionpack", "7.0.4.3" + c.no_checksum "activesupport", "7.0.4.3" + c.no_checksum "govuk_app_config", "4.13.0" + c.no_checksum "railties", "7.0.4.3" + end + simulate_platform "arm64-darwin-22" do bundle "lock" end @@ -1530,13 +1552,7 @@ RSpec.describe "bundle lock" do DEPENDENCIES activesupport (= 7.0.4.3) govuk_app_config - - CHECKSUMS - #{gem_no_checksum "actionpack", "7.0.4.3"} - #{gem_no_checksum "activesupport", "7.0.4.3"} - #{gem_no_checksum "govuk_app_config", "4.13.0"} - #{gem_no_checksum "railties", "7.0.4.3"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 5c7b569fe2..c7b6934526 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -275,6 +275,11 @@ RSpec.describe "bundle update" do gem "countries" G + checksums = checksums_section_when_existing do |c| + c.checksum(gem_repo4, "countries", "3.1.0") + c.checksum(gem_repo4, "country_select", "5.1.0") + end + lockfile <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -289,11 +294,7 @@ RSpec.describe "bundle update" do DEPENDENCIES countries country_select - - CHECKSUMS - #{checksum_for_repo_gem(gem_repo4, "countries", "3.1.0")} - #{checksum_for_repo_gem(gem_repo4, "country_select", "5.1.0")} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -509,9 +510,9 @@ RSpec.describe "bundle update" do original_lockfile = lockfile - expected_checksums = checksum_section do |c| - c.repo_gem gem_repo4, "activesupport", "6.0.4.1" - c.repo_gem gem_repo4, "tzinfo", "1.2.9" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "activesupport", "6.0.4.1" + c.checksum gem_repo4, "tzinfo", "1.2.9" end expected_lockfile = <<~L @@ -527,10 +528,7 @@ RSpec.describe "bundle update" do DEPENDENCIES activesupport (~> 6.0.0) - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1152,9 +1150,10 @@ RSpec.describe "bundle update --ruby" do G gemfile <<-G - source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo1)}" G end + it "removes the Ruby from the Gemfile.lock" do bundle "update --ruby" @@ -1168,8 +1167,6 @@ RSpec.describe "bundle update --ruby" do DEPENDENCIES - CHECKSUMS - BUNDLED WITH #{Bundler::VERSION} L @@ -1184,30 +1181,29 @@ RSpec.describe "bundle update --ruby" do G gemfile <<-G - ruby '~> #{current_ruby_minor}' - source "#{file_uri_for(gem_repo1)}" + ruby '~> #{current_ruby_minor}' + source "#{file_uri_for(gem_repo1)}" G end + it "updates the Gemfile.lock with the latest version" do bundle "update --ruby" expect(lockfile).to eq <<~L - GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - - PLATFORMS - #{lockfile_platforms} + GEM + remote: #{file_uri_for(gem_repo1)}/ + specs: - DEPENDENCIES + PLATFORMS + #{lockfile_platforms} - CHECKSUMS + DEPENDENCIES - RUBY VERSION - #{Bundler::RubyVersion.system} + RUBY VERSION + #{Bundler::RubyVersion.system} - BUNDLED WITH - #{Bundler::VERSION} + BUNDLED WITH + #{Bundler::VERSION} L end end @@ -1257,6 +1253,7 @@ RSpec.describe "bundle update --ruby" do source "#{file_uri_for(gem_repo1)}" G end + it "updates the Gemfile.lock with the latest version" do bundle "update --ruby" @@ -1288,11 +1285,14 @@ RSpec.describe "bundle update --bundler" do build_gem "rack", "1.0" end + checksums = checksums_section_when_existing do |c| + c.checksum(gem_repo4, "rack", "1.0") + end + install_gemfile <<-G source "#{file_uri_for(gem_repo4)}" gem "rack" G - expected_checksum = checksum_for_repo_gem(gem_repo4, "rack", "1.0") expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -1304,10 +1304,7 @@ RSpec.describe "bundle update --bundler" do DEPENDENCIES rack - - CHECKSUMS - #{expected_checksum} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1327,10 +1324,7 @@ RSpec.describe "bundle update --bundler" do DEPENDENCIES rack - - CHECKSUMS - #{expected_checksum} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1351,6 +1345,10 @@ RSpec.describe "bundle update --bundler" do G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") + checksums = checksums_section_when_existing do |c| + c.checksum(gem_repo4, "rack", "1.0") + end + bundle :update, :bundler => true, :artifice => "compact_index", :verbose => true expect(out).to include("Using bundler #{Bundler::VERSION}") @@ -1365,10 +1363,7 @@ RSpec.describe "bundle update --bundler" do DEPENDENCIES rack - - CHECKSUMS - #{checksum_for_repo_gem(gem_repo4, "rack", "1.0")} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1458,8 +1453,11 @@ RSpec.describe "bundle update --bundler" do bundle :update, :bundler => "2.3.0.dev", :verbose => "true" # Only updates properly on modern RubyGems. - if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") + checksums = checksums_section_when_existing do |c| + c.checksum(gem_repo4, "rack", "1.0") + end + expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -1471,10 +1469,7 @@ RSpec.describe "bundle update --bundler" do DEPENDENCIES rack - - CHECKSUMS - #{checksum_for_repo_gem(gem_repo4, "rack", "1.0")} - + #{checksums} BUNDLED WITH 2.3.0.dev L @@ -1500,6 +1495,9 @@ RSpec.describe "bundle update --bundler" do expect(out).not_to include("Fetching gem metadata from https://rubygems.org/") # Only updates properly on modern RubyGems. + checksums = checksums_section_when_existing do |c| + c.checksum(gem_repo4, "rack", "1.0") + end if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") expect(lockfile).to eq <<~L @@ -1513,10 +1511,7 @@ RSpec.describe "bundle update --bundler" do DEPENDENCIES rack - - CHECKSUMS - #{checksum_for_repo_gem(gem_repo4, "rack", "1.0")} - + #{checksums} BUNDLED WITH 2.3.9 L |