summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/install_spec.rb
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2023-09-30 21:01:36 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-10-16 13:49:49 +0900
commitcbf2e133c10b87bb7d1f858471e600af6c6e62d1 (patch)
treeecf5636dd15e88381c8843c54df3bade1cc0db2e /spec/bundler/commands/install_spec.rb
parent7e51cadc2e3574996f63e4afd235d6f3e19f3a59 (diff)
Re-resolve when lockfile is invalid
Move the check for unmet dependencies in lockfile just in time to be able to re-resolve if unmet dependencies are found.
Diffstat (limited to 'spec/bundler/commands/install_spec.rb')
-rw-r--r--spec/bundler/commands/install_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 5271977ed9..92415bd9d5 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -1101,4 +1101,47 @@ RSpec.describe "bundle install with gem sources" do
expect(err).to include("Could not find compatible versions")
end
end
+
+ context "when a lockfile has unmet dependencies, and the Gemfile has no resolution" do
+ before do
+ build_repo4 do
+ build_gem "aaa", "0.2.0" do |s|
+ s.add_dependency "zzz", "< 0.2.0"
+ end
+
+ build_gem "zzz", "0.2.0"
+ end
+
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+
+ gem "aaa"
+ gem "zzz"
+ G
+
+ lockfile <<~L
+ GEM
+ remote: #{file_uri_for(gem_repo4)}/
+ specs:
+ aaa (0.2.0)
+ zzz (< 0.2.0)
+ zzz (0.2.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ aaa!
+ zzz!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+ end
+
+ it "does not install, but raises a resolution error" do
+ bundle "install", :raise_on_error => false
+ expect(err).to include("Could not find compatible versions")
+ end
+ end
end