diff options
Diffstat (limited to 'spec/bundler/install/gemfile/specific_platform_spec.rb')
-rw-r--r-- | spec/bundler/install/gemfile/specific_platform_spec.rb | 164 |
1 files changed, 79 insertions, 85 deletions
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index 7089a94a66..131426b443 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -66,6 +66,10 @@ RSpec.describe "bundle install with specific platforms" do gemfile google_protobuf + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo2, "google-protobuf", "3.0.0.alpha.4.0" + end + # simulate lockfile created with old bundler, which only locks for ruby platform lockfile <<-L GEM @@ -78,16 +82,15 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES google-protobuf - - CHECKSUMS - google-protobuf (3.0.0.alpha.4.0) - + #{checksums} BUNDLED WITH 2.1.4 L bundle "update", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + checksums.checksum gem_repo2, "google-protobuf", "3.0.0.alpha.5.0.5.1" + # make sure the platform that the platform specific dependency is used, since we're only locked to ruby expect(the_bundle).to include_gem("google-protobuf 3.0.0.alpha.5.0.5.1 universal-darwin") @@ -103,10 +106,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES google-protobuf - - CHECKSUMS - google-protobuf (3.0.0.alpha.5.0.5.1) - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -528,11 +528,11 @@ RSpec.describe "bundle install with specific platforms" do bundle "update" - 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 - c.repo_gem gem_repo4, "sorbet-static-and-runtime", "0.5.10160" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "sorbet", "0.5.10160" + c.checksum gem_repo4, "sorbet-runtime", "0.5.10160" + c.checksum gem_repo4, "sorbet-static", "0.5.10160", Gem::Platform.local + c.checksum gem_repo4, "sorbet-static-and-runtime", "0.5.10160" end expect(lockfile).to eq <<~L @@ -552,10 +552,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES sorbet-static-and-runtime - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -587,6 +584,11 @@ RSpec.describe "bundle install with specific platforms" do G end + checksums = checksums_section_when_existing do |c| + c.no_checksum "nokogiri", "1.13.0", "x86_64-darwin" + c.no_checksum "sorbet-static", "0.5.10601", "x86_64-darwin" + end + lockfile <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -602,7 +604,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri sorbet-static - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -624,11 +626,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri sorbet-static - - CHECKSUMS - #{gem_no_checksum "nokogiri", "1.13.0", "x86_64-darwin"} - #{gem_no_checksum "sorbet-static", "0.5.10601", "x86_64-darwin"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -682,11 +680,11 @@ RSpec.describe "bundle install with specific platforms" do bundle "update" - 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 - c.repo_gem gem_repo4, "sorbet-static-and-runtime", "0.5.10160" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "sorbet", "0.5.10160" + c.checksum gem_repo4, "sorbet-runtime", "0.5.10160" + c.checksum gem_repo4, "sorbet-static", "0.5.10160", Gem::Platform.local + c.checksum gem_repo4, "sorbet-static-and-runtime", "0.5.10160" end expect(lockfile).to eq <<~L @@ -706,10 +704,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES sorbet-static-and-runtime - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -760,9 +755,9 @@ RSpec.describe "bundle install with specific platforms" do bundle "update" - expected_checksums = checksum_section do |c| - c.repo_gem gem_repo4, "nokogiri", "1.14.0", "x86_64-linux" - c.repo_gem gem_repo4, "sorbet-static", "0.5.10696", "x86_64-linux" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.14.0", "x86_64-linux" + c.checksum gem_repo4, "sorbet-static", "0.5.10696", "x86_64-linux" end expect(lockfile).to eq <<~L @@ -778,10 +773,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri sorbet-static - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -807,6 +799,11 @@ RSpec.describe "bundle install with specific platforms" do gem "sorbet-static", "= 0.5.10549" G + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "sorbet-static", "0.5.10549", "universal-darwin-20" + c.checksum gem_repo4, "sorbet-static", "0.5.10549", "universal-darwin-21" + end + # Make sure the lockfile is missing sorbet-static-0.5.10549-universal-darwin-21 lockfile <<~L GEM @@ -819,17 +816,15 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES sorbet-static (= 0.5.10549) - - 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"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L bundle "install" + checksums.no_checksum "sorbet-static", "0.5.10549", "universal-darwin-21" + expect(lockfile).to eq <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -842,11 +837,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES sorbet-static (= 0.5.10549) - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "sorbet-static", "0.5.10549", "universal-darwin-20"} - #{gem_no_checksum "sorbet-static", "0.5.10549", "universal-darwin-21"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -893,6 +884,11 @@ RSpec.describe "bundle install with specific platforms" do bundle "lock --update" + checksums = checksums_section_when_existing do |c| + c.no_checksum "nokogiri", "1.13.8" + c.no_checksum "nokogiri", "1.13.8", Gem::Platform.local + end + updated_lockfile = <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -906,11 +902,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri tzinfo (~> 1.2) - - CHECKSUMS - #{gem_no_checksum "nokogiri", "1.13.8"} - #{gem_no_checksum "nokogiri", "1.13.8", Gem::Platform.local} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -931,6 +923,11 @@ RSpec.describe "bundle install with specific platforms" do gem "rack" G + checksums = checksums_section_when_existing do |c| + c.no_checksum "concurrent-ruby", "1.2.2" + c.no_checksum "rack", "3.0.7" + end + lockfile <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -942,7 +939,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES concurrent-ruby - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -962,11 +959,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES concurrent-ruby rack - - CHECKSUMS - #{gem_no_checksum "concurrent-ruby", "1.2.2"} - #{gem_no_checksum "rack", "3.0.7"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1029,6 +1022,10 @@ RSpec.describe "bundle install with specific platforms" do gem "nokogiri", "1.14.0" G + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.14.0", "x86_64-linux" + end + lockfile <<~L GEM remote: #{file_uri_for(gem_repo4)}/ @@ -1040,13 +1037,17 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri (= 1.14.0) - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L bundle :install + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.14.0" + end + expect(lockfile).to eq(<<~L) GEM remote: #{file_uri_for(gem_repo4)}/ @@ -1058,10 +1059,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri (= 1.14.0) - - CHECKSUMS - #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.14.0"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1101,6 +1099,12 @@ RSpec.describe "bundle install with specific platforms" do bundle "lock" + checksums = checksums_section_when_existing do |c| + c.no_checksum "nokogiri", "1.14.0" + c.no_checksum "nokogiri", "1.14.0", "arm-linux" + c.no_checksum "nokogiri", "1.14.0", "x86_64-linux" + end + # locks all compatible platforms, excluding Java and Windows expect(lockfile).to eq(<<~L) GEM @@ -1117,12 +1121,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri - - CHECKSUMS - #{gem_no_checksum "nokogiri", "1.14.0"} - #{gem_no_checksum "nokogiri", "1.14.0", "arm-linux"} - #{gem_no_checksum "nokogiri", "1.14.0", "x86_64-linux"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1138,6 +1137,10 @@ RSpec.describe "bundle install with specific platforms" do bundle "lock" + checksums.delete "nokogiri", "arm-linux" + checksums.no_checksum "sorbet-static", "0.5.10696", "universal-darwin-22" + checksums.no_checksum "sorbet-static", "0.5.10696", "x86_64-linux" + # locks only platforms compatible with all gems in the bundle expect(lockfile).to eq(<<~L) GEM @@ -1155,13 +1158,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri sorbet-static - - CHECKSUMS - #{gem_no_checksum "nokogiri", "1.14.0"} - #{gem_no_checksum "nokogiri", "1.14.0", "x86_64-linux"} - #{gem_no_checksum "sorbet-static", "0.5.10696", "universal-darwin-22"} - #{gem_no_checksum "sorbet-static", "0.5.10696", "x86_64-linux"} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L @@ -1191,10 +1188,10 @@ RSpec.describe "bundle install with specific platforms" do gem "sass-embedded" G - expected_checksums = checksum_section do |c| - c.repo_gem gem_repo4, "nokogiri", "1.15.5" + checksums = checksums_section_when_existing do |c| + c.checksum gem_repo4, "nokogiri", "1.15.5" c.no_checksum "sass-embedded", "1.69.5" - c.repo_gem gem_repo4, "sass-embedded", "1.69.5", "x86_64-linux-gnu" + c.checksum gem_repo4, "sass-embedded", "1.69.5", "x86_64-linux-gnu" end simulate_platform "x86_64-linux" do @@ -1216,10 +1213,7 @@ RSpec.describe "bundle install with specific platforms" do DEPENDENCIES nokogiri sass-embedded - - CHECKSUMS - #{expected_checksums} - + #{checksums} BUNDLED WITH #{Bundler::VERSION} L |