summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-03-16 18:37:42 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-23 17:18:49 +0900
commit8e6bbc032c1bde617a45e418af697831df471083 (patch)
tree1c72bed11329f3c2151c2702a817d05500bc6110 /spec/bundler
parent4e7c39f98ceaf5160d9a97b7d2405623f972773a (diff)
downloadruby-8e6bbc032c1bde617a45e418af697831df471083.tar.gz
Don't remove RUBY platform when healing a lockfile with missing specs
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/lock/lockfile_spec.rb92
1 files changed, 53 insertions, 39 deletions
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index 78130d8f15..d8fd09eb54 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -1272,57 +1272,71 @@ RSpec.describe "the lockfile format" do
G
end
- it "auto-heals when the lockfile is missing dependent specs" do
- build_repo4 do
- build_gem "minitest-bisect", "1.6.0" do |s|
- s.add_dependency "path_expander", "~> 1.1"
+ shared_examples_for "a lockfile missing dependent specs" do
+ it "auto-heals" do
+ build_repo4 do
+ build_gem "minitest-bisect", "1.6.0" do |s|
+ s.add_dependency "path_expander", "~> 1.1"
+ end
+
+ build_gem "path_expander", "1.1.1"
end
- build_gem "path_expander", "1.1.1"
- end
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+ gem "minitest-bisect"
+ G
- gemfile <<~G
- source "#{file_uri_for(gem_repo4)}"
- gem "minitest-bisect"
- G
+ # Corrupt lockfile (completely missing path_expander)
+ lockfile <<~L
+ GEM
+ remote: #{file_uri_for(gem_repo4)}/
+ specs:
+ minitest-bisect (1.6.0)
- # Corrupt lockfile (completely missing path_expander)
- lockfile <<~L
- GEM
- remote: #{file_uri_for(gem_repo4)}/
- specs:
- minitest-bisect (1.6.0)
+ PLATFORMS
+ #{platforms}
- PLATFORMS
- #{lockfile_platforms}
+ DEPENDENCIES
+ minitest-bisect
- DEPENDENCIES
- minitest-bisect
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
- BUNDLED WITH
- #{Bundler::VERSION}
- L
+ cache_gems "minitest-bisect-1.6.0", "path_expander-1.1.1", :gem_repo => gem_repo4
+ bundle :install
- cache_gems "minitest-bisect-1.6.0", "path_expander-1.1.1", :gem_repo => gem_repo4
- bundle :install
+ expect(lockfile).to eq <<~L
+ GEM
+ remote: #{file_uri_for(gem_repo4)}/
+ specs:
+ minitest-bisect (1.6.0)
+ path_expander (~> 1.1)
+ path_expander (1.1.1)
- expect(lockfile).to eq <<~L
- GEM
- remote: #{file_uri_for(gem_repo4)}/
- specs:
- minitest-bisect (1.6.0)
- path_expander (~> 1.1)
- path_expander (1.1.1)
+ PLATFORMS
+ #{platforms}
- PLATFORMS
- #{lockfile_platforms}
+ DEPENDENCIES
+ minitest-bisect
- DEPENDENCIES
- minitest-bisect
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+ end
+ end
- BUNDLED WITH
- #{Bundler::VERSION}
- L
+ context "with just specific platform" do
+ let(:platforms) { lockfile_platforms }
+
+ it_behaves_like "a lockfile missing dependent specs"
+ end
+
+ context "with both ruby and specific platform" do
+ let(:platforms) { lockfile_platforms("ruby") }
+
+ it_behaves_like "a lockfile missing dependent specs"
end
it "auto-heals when the lockfile is missing specs" do