diff options
Diffstat (limited to 'spec/bundler/install/bundler_spec.rb')
-rw-r--r-- | spec/bundler/install/bundler_spec.rb | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb index c1ce57e60e..08b7e2b673 100644 --- a/spec/bundler/install/bundler_spec.rb +++ b/spec/bundler/install/bundler_spec.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -require "spec_helper" RSpec.describe "bundle install" do describe "with bundler dependencies" do @@ -38,8 +37,6 @@ RSpec.describe "bundle install" do G nice_error = <<-E.strip.gsub(/^ {8}/, "") - Fetching source index from file:#{gem_repo2}/ - Resolving dependencies... Bundler could not find compatible versions for gem "bundler": In Gemfile: bundler (= 0.9.2) @@ -49,9 +46,9 @@ RSpec.describe "bundle install" do This Gemfile requires a different version of Bundler. Perhaps you need to update Bundler by running `gem install bundler`? - Could not find gem 'bundler (= 0.9.2)' in any of the sources + Could not find gem 'bundler (= 0.9.2)' in any E - expect(out).to eq(nice_error) + expect(last_command.bundler_err).to include(nice_error) end it "works for gems with multiple versions in its dependencies" do @@ -99,8 +96,6 @@ RSpec.describe "bundle install" do G nice_error = <<-E.strip.gsub(/^ {8}/, "") - Fetching source index from file:#{gem_repo2}/ - Resolving dependencies... Bundler could not find compatible versions for gem "activesupport": In Gemfile: activemerchant was resolved to 1.0, which depends on @@ -109,7 +104,7 @@ RSpec.describe "bundle install" do rails_fail was resolved to 1.0, which depends on activesupport (= 1.2.3) E - expect(out).to include(nice_error) + expect(last_command.bundler_err).to include(nice_error) end it "causes a conflict if a child dependency conflicts with the Gemfile" do @@ -120,8 +115,6 @@ RSpec.describe "bundle install" do G nice_error = <<-E.strip.gsub(/^ {8}/, "") - Fetching source index from file:#{gem_repo2}/ - Resolving dependencies... Bundler could not find compatible versions for gem "activesupport": In Gemfile: activesupport (= 2.3.5) @@ -129,19 +122,55 @@ RSpec.describe "bundle install" do rails_fail was resolved to 1.0, which depends on activesupport (= 1.2.3) E - expect(out).to include(nice_error) + expect(last_command.bundler_err).to include(nice_error) end - it "can install dependencies with newer bundler version" do - install_gemfile <<-G + it "can install dependencies with newer bundler version with system gems", :ruby => "> 2" do + bundle! "config path.system true" + install_gemfile! <<-G + source "file://#{gem_repo2}" + gem "rails", "3.0" + G + + simulate_bundler_version "99999999.99.1" + + bundle! "check", :env => { "BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD" => "1" } + expect(out).to include("The Gemfile's dependencies are satisfied") + end + + it "can install dependencies with newer bundler version with a local path", :ruby => "> 2" do + bundle! "config path .bundle" + install_gemfile! <<-G source "file://#{gem_repo2}" gem "rails", "3.0" G - simulate_bundler_version "10.0.0" + simulate_bundler_version "99999999.99.1" - bundle "check" + bundle! "check", :env => { "BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD" => "1" } expect(out).to include("The Gemfile's dependencies are satisfied") end + + context "with allow_bundler_dependency_conflicts set" do + before { bundle! "config allow_bundler_dependency_conflicts true" } + + it "are forced to the current bundler version with warnings when no compatible version is found" do + build_repo4 do + build_gem "requires_nonexistant_bundler" do |s| + s.add_runtime_dependency "bundler", "99.99.99.99" + end + end + + install_gemfile! <<-G + source "file://#{gem_repo4}" + gem "requires_nonexistant_bundler" + G + + expect(out).to include "requires_nonexistant_bundler (1.0) has dependency bundler (= 99.99.99.99), " \ + "which is unsatisfied by the current bundler version #{Bundler::VERSION}, so the dependency is being ignored" + + expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}", "requires_nonexistant_bundler 1.0" + end + end end end |