summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/definition_spec.rb1
-rw-r--r--spec/bundler/commands/lock_spec.rb139
-rw-r--r--spec/bundler/commands/update_spec.rb16
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/install_if_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb1
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb6
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb35
-rw-r--r--spec/bundler/install/yanked_spec.rb1
-rw-r--r--spec/bundler/runtime/platform_spec.rb3
-rw-r--r--spec/bundler/support/checksums.rb2
11 files changed, 203 insertions, 7 deletions
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb
index a5d244d3aa..3676ed21c8 100644
--- a/spec/bundler/bundler/definition_spec.rb
+++ b/spec/bundler/bundler/definition_spec.rb
@@ -168,6 +168,7 @@ RSpec.describe Bundler::Definition do
only_java
CHECKSUMS
+ #{checksum_for_repo_gem gem_repo1, "only_java", "1.1", "java"}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index ff387a5990..4426c484fb 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -11,6 +11,18 @@ RSpec.describe "bundle lock" do
gem "foo"
G
+ expected_checksums = construct_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"
+ end
+
@lockfile = <<~L
GEM
remote: #{file_uri_for(repo)}/
@@ -43,6 +55,7 @@ RSpec.describe "bundle lock" do
weakling
CHECKSUMS
+ #{expected_checksums}
BUNDLED WITH
#{Bundler::VERSION}
@@ -107,6 +120,7 @@ RSpec.describe "bundle lock" do
foo
CHECKSUMS
+ #{checksum_for_repo_gem repo, "foo", "1.0"}
BUNDLED WITH
#{Bundler::VERSION}
@@ -501,6 +515,10 @@ 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"}
+
BUNDLED WITH
#{Bundler::VERSION}
L
@@ -521,6 +539,9 @@ RSpec.describe "bundle lock" do
DEPENDENCIES
nokogiri
+ CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.12.0", "x86_64-darwin"}
+
BUNDLED WITH
#{Bundler::VERSION}
L
@@ -590,6 +611,10 @@ RSpec.describe "bundle lock" do
mixlib-shellout
CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "ffi", "1.9.14", "x86-mingw32"}
+ #{checksum_for_repo_gem gem_repo4, "gssapi", "1.2.0"}
+ #{checksum_for_repo_gem gem_repo4, "mixlib-shellout", "2.2.6", "universal-mingw32"}
+ #{checksum_for_repo_gem gem_repo4, "win32-process", "0.8.3"}
BUNDLED WITH
#{Bundler::VERSION}
@@ -621,6 +646,12 @@ RSpec.describe "bundle lock" do
mixlib-shellout
CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "ffi", "1.9.14"}
+ #{checksum_for_repo_gem gem_repo4, "ffi", "1.9.14", "x86-mingw32"}
+ #{checksum_for_repo_gem gem_repo4, "gssapi", "1.2.0"}
+ #{checksum_for_repo_gem gem_repo4, "mixlib-shellout", "2.2.6"}
+ #{checksum_for_repo_gem gem_repo4, "mixlib-shellout", "2.2.6", "universal-mingw32"}
+ #{checksum_for_repo_gem gem_repo4, "win32-process", "0.8.3"}
BUNDLED WITH
#{Bundler::VERSION}
@@ -701,6 +732,8 @@ RSpec.describe "bundle lock" do
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"}
BUNDLED WITH
#{Bundler::VERSION}
@@ -907,14 +940,114 @@ RSpec.describe "bundle lock" do
it "does not implicitly update" do
bundle "lock"
- expect(read_lockfile).to eq(@lockfile)
+ expected_checksums = construct_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"
+ end
+
+ expected_lockfile = strip_lockfile(<<-L)
+ GEM
+ remote: #{file_uri_for(repo)}/
+ specs:
+ actionmailer (2.3.2)
+ activesupport (= 2.3.2)
+ actionpack (2.3.2)
+ activesupport (= 2.3.2)
+ activerecord (2.3.2)
+ activesupport (= 2.3.2)
+ activeresource (2.3.2)
+ activesupport (= 2.3.2)
+ activesupport (2.3.2)
+ foo (1.0)
+ rails (2.3.2)
+ actionmailer (= 2.3.2)
+ actionpack (= 2.3.2)
+ activerecord (= 2.3.2)
+ activeresource (= 2.3.2)
+ rake (= 13.0.1)
+ rake (13.0.1)
+ weakling (0.0.3)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo
+ rails
+ weakling
+
+ CHECKSUMS
+ #{expected_checksums}
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ expect(read_lockfile).to eq(expected_lockfile)
end
it "accounts for changes in the gemfile" do
gemfile gemfile.gsub('"foo"', '"foo", "2.0"')
bundle "lock"
- expect(read_lockfile).to eq(@lockfile.sub("foo (1.0)", "foo (2.0)").sub(/foo$/, "foo (= 2.0)"))
+ expected_checksums = construct_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", "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"
+ end
+
+ expected_lockfile = strip_lockfile(<<-L)
+ GEM
+ remote: #{file_uri_for(repo)}/
+ specs:
+ actionmailer (2.3.2)
+ activesupport (= 2.3.2)
+ actionpack (2.3.2)
+ activesupport (= 2.3.2)
+ activerecord (2.3.2)
+ activesupport (= 2.3.2)
+ activeresource (2.3.2)
+ activesupport (= 2.3.2)
+ activesupport (2.3.2)
+ foo (2.0)
+ rails (2.3.2)
+ actionmailer (= 2.3.2)
+ actionpack (= 2.3.2)
+ activerecord (= 2.3.2)
+ activeresource (= 2.3.2)
+ rake (= 13.0.1)
+ rake (13.0.1)
+ weakling (0.0.3)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo (= 2.0)
+ rails
+ weakling
+
+ CHECKSUMS
+ #{expected_checksums}
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ expect(read_lockfile).to eq(expected_lockfile)
end
end
@@ -985,6 +1118,8 @@ RSpec.describe "bundle lock" do
debug
CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "debug", "1.6.3"}
+ #{checksum_for_repo_gem gem_repo4, "irb", "1.5.0"}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index eb578d4dff..cf6a8d5be1 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -291,6 +291,8 @@ RSpec.describe "bundle update" do
country_select
CHECKSUMS
+ #{checksum_for_repo_gem(gem_repo4, "countries", "3.1.0")}
+ #{checksum_for_repo_gem(gem_repo4, "country_select", "5.1.0")}
BUNDLED WITH
#{Bundler::VERSION}
@@ -560,6 +562,7 @@ RSpec.describe "bundle update" do
activesupport (~> 6.0.0)
CHECKSUMS
+ #{expected_checksums}
BUNDLED WITH
#{Bundler::VERSION}
@@ -1282,7 +1285,7 @@ RSpec.describe "bundle update --bundler" do
G
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
- excepted_checksum = checksum_for_repo_gem(gem_repo4, "rack", "1.0")
+ expected_checksum = checksum_for_repo_gem(gem_repo4, "rack", "1.0")
FileUtils.rm_r gem_repo4
@@ -1302,7 +1305,7 @@ RSpec.describe "bundle update --bundler" do
rack
CHECKSUMS
- #{excepted_checksum}
+ #{expected_checksum}
BUNDLED WITH
#{Bundler::VERSION}
@@ -1714,6 +1717,14 @@ RSpec.describe "bundle update conservative" do
it "should only change direct dependencies when updating the lockfile with --conservative" do
bundle "lock --update --conservative"
+ expected_checksums = construct_checksum_section do |c|
+ c.repo_gem gem_repo4, "isolated_dep", "2.0.1"
+ c.repo_gem gem_repo4, "isolated_owner", "1.0.2"
+ c.repo_gem gem_repo4, "shared_dep", "5.0.1"
+ c.repo_gem gem_repo4, "shared_owner_a", "3.0.2"
+ c.repo_gem gem_repo4, "shared_owner_b", "4.0.2"
+ end
+
expect(lockfile).to eq <<~L
GEM
remote: #{file_uri_for(gem_repo4)}/
@@ -1736,6 +1747,7 @@ RSpec.describe "bundle update conservative" do
shared_owner_b
CHECKSUMS
+ #{expected_checksums}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 23f1a05c10..f72726fec1 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -451,6 +451,7 @@ RSpec.describe "bundle install from an existing gemspec" do
expected_checksums = construct_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
end
@@ -494,6 +495,7 @@ RSpec.describe "bundle install from an existing gemspec" do
expected_checksums = construct_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
end
@@ -539,6 +541,7 @@ RSpec.describe "bundle install from an existing gemspec" do
expected_checksums = construct_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"
c.repo_gem gem_repo2, "platform_specific", "1.0", x64_mingw32
end
@@ -718,6 +721,7 @@ RSpec.describe "bundle install from an existing gemspec" do
CHECKSUMS
activeadmin (2.9.0)
+ #{checksum_for_repo_gem gem_repo4, "jruby-openssl", "0.10.7", "java"}
#{checksum_for_repo_gem gem_repo4, "railties", "6.1.4"}
BUNDLED WITH
diff --git a/spec/bundler/install/gemfile/install_if_spec.rb b/spec/bundler/install/gemfile/install_if_spec.rb
index 441b309afe..96b7f07d16 100644
--- a/spec/bundler/install/gemfile/install_if_spec.rb
+++ b/spec/bundler/install/gemfile/install_if_spec.rb
@@ -39,7 +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"}
#{checksum_for_repo_gem gem_repo1, "rack", "1.0.0"}
+ #{checksum_for_repo_gem gem_repo1, "thin", "1.0"}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index 3992d11458..de474d968e 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -407,6 +407,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")}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 40c4bebdd3..318b4907df 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -1567,6 +1567,11 @@ 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|
+ c.repo_gem gem_repo2, "capybara", "2.5.0"
+ c.repo_gem gem_repo4, "mime-types", "3.0.0"
+ end
+
expect(lockfile).to eq <<~L
GEM
remote: https://gem.repo2/
@@ -1587,6 +1592,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
mime-types (~> 3.0)!
CHECKSUMS
+ #{expected_checksums}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 6938507dd5..4718d0dec1 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -621,6 +621,10 @@ RSpec.describe "bundle install with specific platforms" do
nokogiri
sorbet-static
+ CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.0", "x86_64-darwin"}
+ #{checksum_for_repo_gem gem_repo4, "sorbet-static", "0.5.10601", "x86_64-darwin"}
+
BUNDLED WITH
#{Bundler::VERSION}
L
@@ -822,6 +826,10 @@ 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"}
+
BUNDLED WITH
#{Bundler::VERSION}
L
@@ -868,7 +876,29 @@ RSpec.describe "bundle install with specific platforms" do
bundle "lock --update"
- expect(lockfile).to eq(original_lockfile)
+ updated_lockfile = <<~L
+ GEM
+ remote: #{file_uri_for(gem_repo4)}/
+ specs:
+ nokogiri (1.13.8)
+ nokogiri (1.13.8-#{Gem::Platform.local})
+
+ PLATFORMS
+ #{lockfile_platforms_for([specific_local_platform, "ruby"])}
+
+ DEPENDENCIES
+ nokogiri
+ tzinfo (~> 1.2)
+
+ CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.8"}
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.13.8", "arm64-darwin-22"}
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ expect(lockfile).to eq(updated_lockfile)
end
it "does not remove ruby when adding a new gem to the Gemfile" do
@@ -1008,6 +1038,9 @@ RSpec.describe "bundle install with specific platforms" do
DEPENDENCIES
nokogiri (= 1.14.0)
+ CHECKSUMS
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.14.0"}
+
BUNDLED WITH
#{Bundler::VERSION}
L
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index 930e3c4791..bc84e25417 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -161,6 +161,7 @@ RSpec.context "when resolving a bundle that includes yanked gems, but unlocking
foo
CHECKSUMS
+ #{checksum_for_repo_gem(gem_repo4, "bar", "2.0.0")}
BUNDLED WITH
#{Bundler::VERSION}
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index d0af8b1c1c..31d93a559f 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -92,7 +92,8 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
nokogiri (~> 1.11)
CHECKSUMS
- nokogiri (1.11.1)
+ #{checksum_for_repo_gem gem_repo4, "mini_portile2", "2.5.0"}
+ #{checksum_for_repo_gem gem_repo4, "nokogiri", "1.11.1"}
#{checksum_for_repo_gem gem_repo4, "nokogiri", "1.11.1", Bundler.local_platform}
#{checksum_for_repo_gem gem_repo4, "racca", "1.5.2"}
diff --git a/spec/bundler/support/checksums.rb b/spec/bundler/support/checksums.rb
index 3594b93518..93e27402c7 100644
--- a/spec/bundler/support/checksums.rb
+++ b/spec/bundler/support/checksums.rb
@@ -15,7 +15,7 @@ module Spec
end
checksum = sha256_checksum(gem_file)
- @checksums << Bundler::Checksum.new(gem_name, gem_version, platform, checksum)
+ @checksums << Bundler::Checksum.new(gem_name, gem_version, platform, [checksum])
end
def to_lock