diff options
Diffstat (limited to 'spec/bundler/commands/install_spec.rb')
-rw-r--r-- | spec/bundler/commands/install_spec.rb | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 41aa903f27..df30a63c36 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app_lock).to exist end - it "does not create ./.bundle by default", bundler: "< 3" do + it "does not create ./.bundle by default", bundler: "2" do gemfile <<-G source "https://gem.repo1" gem "myrack" @@ -334,14 +334,14 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "myrack 1.0" end - it "allows running bundle install --system without deleting foo", bundler: "< 3" do + it "allows running bundle install --system without deleting foo", bundler: "2" do bundle "install --path vendor" bundle "install --system" FileUtils.rm_r(bundled_app("vendor")) expect(the_bundle).to include_gems "myrack 1.0" end - it "allows running bundle install --system after deleting foo", bundler: "< 3" do + it "allows running bundle install --system after deleting foo", bundler: "2" do bundle "install --path vendor" FileUtils.rm_r(bundled_app("vendor")) bundle "install --system" @@ -349,7 +349,7 @@ RSpec.describe "bundle install with gem sources" do end end - it "finds gems in multiple sources", bundler: "< 3" do + it "finds gems in multiple sources", bundler: "2" do build_repo2 do build_gem "myrack", "1.2" do |s| s.executables = "myrackup" @@ -1500,6 +1500,55 @@ RSpec.describe "bundle install with gem sources" do end end + context "when lockfile has incorrect dependencies" do + before do + build_repo2 + + gemfile <<-G + source "https://gem.repo2" + gem "myrack_middleware" + G + + system_gems "myrack_middleware-1.0", path: default_bundle_path + + # we want to raise when the 1.0 line should be followed by " myrack (= 0.9.1)" but isn't + lockfile <<-L + GEM + remote: https://gem.repo2/ + specs: + myrack_middleware (1.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + myrack_middleware + + BUNDLED WITH + #{Bundler::VERSION} + L + end + + it "raises a clear error message when frozen" do + bundle "config set frozen true" + bundle "install", raise_on_error: false + + expect(exitstatus).to eq(41) + expect(err).to eq("Bundler found incorrect dependencies in the lockfile for myrack_middleware-1.0") + end + + it "updates the lockfile when not frozen" do + missing_dep = "myrack (0.9.1)" + expect(lockfile).not_to include(missing_dep) + + bundle "config set frozen false" + bundle :install + + expect(lockfile).to include(missing_dep) + expect(out).to include("now installed") + end + end + context "with --local flag" do before do system_gems "myrack-1.0.0", path: default_bundle_path |