2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.describe "bundle install" do
|
|
|
|
describe "with bundler dependencies" do
|
|
|
|
before(:each) do
|
|
|
|
build_repo2 do
|
|
|
|
build_gem "rails", "3.0" do |s|
|
|
|
|
s.add_dependency "bundler", ">= 0.9.0.pre"
|
|
|
|
end
|
|
|
|
build_gem "bundler", "0.9.1"
|
|
|
|
build_gem "bundler", Bundler::VERSION
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "are forced to the current bundler version" do
|
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rails", "3.0"
|
|
|
|
G
|
|
|
|
|
|
|
|
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}"
|
|
|
|
end
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
it "are forced to the current bundler version even if not already present" do
|
2018-11-02 19:07:56 -04:00
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo1)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rack"
|
|
|
|
G
|
2021-02-01 10:17:16 -05:00
|
|
|
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
it "causes a conflict if explicitly requesting a different version of bundler" do
|
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
|
|
|
gem "rails", "3.0"
|
|
|
|
gem "bundler", "0.9.1"
|
|
|
|
G
|
2019-07-23 07:11:33 -04:00
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
nice_error = <<-E.strip.gsub(/^ {8}/, "")
|
|
|
|
Bundler could not find compatible versions for gem "bundler":
|
|
|
|
In Gemfile:
|
|
|
|
bundler (= 0.9.1)
|
|
|
|
|
|
|
|
Current Bundler version:
|
|
|
|
bundler (#{Bundler::VERSION})
|
|
|
|
|
|
|
|
Your bundle requires a different version of Bundler than the one you're running.
|
|
|
|
Install the necessary version with `gem install bundler:0.9.1` and rerun bundler using `bundle _0.9.1_ install`
|
|
|
|
E
|
|
|
|
expect(err).to include(nice_error)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "causes a conflict if explicitly requesting a non matching requirement on bundler" do
|
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
|
|
|
gem "rails", "3.0"
|
|
|
|
gem "bundler", "~> 0.8"
|
|
|
|
G
|
|
|
|
|
|
|
|
nice_error = <<-E.strip.gsub(/^ {8}/, "")
|
|
|
|
Bundler could not find compatible versions for gem "bundler":
|
|
|
|
In Gemfile:
|
|
|
|
bundler (~> 0.8)
|
|
|
|
|
|
|
|
Current Bundler version:
|
|
|
|
bundler (#{Bundler::VERSION})
|
|
|
|
|
|
|
|
Your bundle requires a different version of Bundler than the one you're running.
|
|
|
|
Install the necessary version with `gem install bundler:0.9.1` and rerun bundler using `bundle _0.9.1_ install`
|
|
|
|
E
|
|
|
|
expect(err).to include(nice_error)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "causes a conflict if explicitly requesting a version of bundler that doesn't exist" do
|
2020-06-03 12:43:17 -04:00
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rails", "3.0"
|
|
|
|
gem "bundler", "0.9.2"
|
|
|
|
G
|
|
|
|
|
|
|
|
nice_error = <<-E.strip.gsub(/^ {8}/, "")
|
|
|
|
Bundler could not find compatible versions for gem "bundler":
|
|
|
|
In Gemfile:
|
|
|
|
bundler (= 0.9.2)
|
|
|
|
|
|
|
|
Current Bundler version:
|
|
|
|
bundler (#{Bundler::VERSION})
|
|
|
|
|
2021-02-01 10:17:16 -05:00
|
|
|
Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.
|
2018-11-02 19:07:56 -04:00
|
|
|
E
|
2019-06-01 05:49:40 -04:00
|
|
|
expect(err).to include(nice_error)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "works for gems with multiple versions in its dependencies" do
|
2020-12-08 02:36:29 -05:00
|
|
|
build_repo2 do
|
|
|
|
build_gem "multiple_versioned_deps" do |s|
|
|
|
|
s.add_dependency "weakling", ">= 0.0.1", "< 0.1"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
|
|
|
|
gem "multiple_versioned_deps"
|
|
|
|
G
|
|
|
|
|
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
|
|
|
|
gem "multiple_versioned_deps"
|
|
|
|
gem "rack"
|
|
|
|
G
|
|
|
|
|
|
|
|
expect(the_bundle).to include_gems "multiple_versioned_deps 1.0.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "includes bundler in the bundle when it's a child dependency" do
|
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rails", "3.0"
|
|
|
|
G
|
|
|
|
|
|
|
|
run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError; puts 'FAIL'; end"
|
|
|
|
expect(out).to eq("WIN")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do
|
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rack"
|
|
|
|
G
|
|
|
|
|
|
|
|
run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end"
|
|
|
|
expect(out).to eq("WIN")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "causes a conflict if child dependencies conflict" do
|
2019-07-23 07:11:33 -04:00
|
|
|
bundle "config set force_ruby_platform true"
|
|
|
|
|
2020-12-08 02:36:29 -05:00
|
|
|
update_repo2 do
|
|
|
|
build_gem "rails_pinned_to_old_activesupport" do |s|
|
|
|
|
s.add_dependency "activesupport", "= 1.2.3"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-03 12:43:17 -04:00
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "activemerchant"
|
2020-06-07 07:23:10 -04:00
|
|
|
gem "rails_pinned_to_old_activesupport"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
|
|
|
nice_error = <<-E.strip.gsub(/^ {8}/, "")
|
|
|
|
Bundler could not find compatible versions for gem "activesupport":
|
|
|
|
In Gemfile:
|
|
|
|
activemerchant was resolved to 1.0, which depends on
|
|
|
|
activesupport (>= 2.0.0)
|
|
|
|
|
2020-06-07 07:23:10 -04:00
|
|
|
rails_pinned_to_old_activesupport was resolved to 1.0, which depends on
|
2018-11-02 19:07:56 -04:00
|
|
|
activesupport (= 1.2.3)
|
|
|
|
E
|
2019-06-01 05:49:40 -04:00
|
|
|
expect(err).to include(nice_error)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "causes a conflict if a child dependency conflicts with the Gemfile" do
|
2019-07-23 07:11:33 -04:00
|
|
|
bundle "config set force_ruby_platform true"
|
|
|
|
|
2020-12-08 02:36:29 -05:00
|
|
|
update_repo2 do
|
|
|
|
build_gem "rails_pinned_to_old_activesupport" do |s|
|
|
|
|
s.add_dependency "activesupport", "= 1.2.3"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-03 12:43:17 -04:00
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2020-06-07 07:23:10 -04:00
|
|
|
gem "rails_pinned_to_old_activesupport"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "activesupport", "2.3.5"
|
|
|
|
G
|
|
|
|
|
|
|
|
nice_error = <<-E.strip.gsub(/^ {8}/, "")
|
|
|
|
Bundler could not find compatible versions for gem "activesupport":
|
|
|
|
In Gemfile:
|
|
|
|
activesupport (= 2.3.5)
|
|
|
|
|
2020-06-07 07:23:10 -04:00
|
|
|
rails_pinned_to_old_activesupport was resolved to 1.0, which depends on
|
2018-11-02 19:07:56 -04:00
|
|
|
activesupport (= 1.2.3)
|
|
|
|
E
|
2019-06-01 05:49:40 -04:00
|
|
|
expect(err).to include(nice_error)
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2020-06-07 07:07:27 -04:00
|
|
|
it "does not cause a conflict if new dependencies in the Gemfile require older dependencies than the lockfile" do
|
2020-12-08 02:36:29 -05:00
|
|
|
update_repo2 do
|
|
|
|
build_gem "rails_pinned_to_old_activesupport" do |s|
|
|
|
|
s.add_dependency "activesupport", "= 1.2.3"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-06-03 14:46:03 -04:00
|
|
|
install_gemfile <<-G
|
2020-06-07 07:07:27 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
|
|
|
gem 'rails', "2.3.2"
|
|
|
|
G
|
|
|
|
|
|
|
|
install_gemfile <<-G
|
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2020-06-07 07:23:10 -04:00
|
|
|
gem "rails_pinned_to_old_activesupport"
|
2020-06-07 07:07:27 -04:00
|
|
|
G
|
|
|
|
|
|
|
|
expect(out).to include("Installing activesupport 1.2.3 (was 2.3.2)")
|
|
|
|
expect(err).to be_empty
|
|
|
|
end
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
it "can install dependencies with newer bundler version with system gems" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "config set path.system true"
|
2020-05-08 01:19:04 -04:00
|
|
|
|
|
|
|
system_gems "bundler-99999999.99.1"
|
|
|
|
|
2020-06-03 14:46:03 -04:00
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rails", "3.0"
|
|
|
|
G
|
|
|
|
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "check"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to include("The Gemfile's dependencies are satisfied")
|
|
|
|
end
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
it "can install dependencies with newer bundler version with a local path" do
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "config set path .bundle"
|
2020-05-08 01:19:04 -04:00
|
|
|
|
|
|
|
system_gems "bundler-99999999.99.1"
|
|
|
|
|
2020-06-03 14:46:03 -04:00
|
|
|
install_gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo2)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rails", "3.0"
|
|
|
|
G
|
|
|
|
|
2020-06-03 14:45:36 -04:00
|
|
|
bundle "check"
|
2018-11-02 19:07:56 -04:00
|
|
|
expect(out).to include("The Gemfile's dependencies are satisfied")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|