summaryrefslogtreecommitdiff
path: root/spec/install/gems/resolving_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/install/gems/resolving_spec.rb')
-rw-r--r--spec/install/gems/resolving_spec.rb62
1 files changed, 58 insertions, 4 deletions
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 52511ff67f..323b28fdb1 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -19,6 +19,8 @@ RSpec.describe "bundle install with install-time dependencies" do
end
it "installs gems with a dependency with no type" do
+ skip "incorrect data check error" if Gem.win_platform?
+
build_repo2
path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
@@ -67,6 +69,20 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(the_bundle).to include_gems "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
end
+ context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do
+ it "produces debug output" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "net_c"
+ gem "net_e"
+ G
+
+ bundle :install, :env => { "BUNDLER_DEBUG_RESOLVER" => "1" }
+
+ expect(err).to include("Creating possibility state for net_c")
+ end
+ end
+
context "with ENV['DEBUG_RESOLVER'] set" do
it "produces debug output" do
gemfile <<-G
@@ -101,6 +117,10 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "when a required ruby version" do
context "allows only an older version" do
+ before do
+ skip "gem not found" if Gem.win_platform?
+ end
+
it "installs the older version" do
build_repo2 do
build_gem "rack", "9001.0.0" do |s|
@@ -137,6 +157,31 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
expect(the_bundle).to include_gems("rack 1.2")
end
+
+ it "installs the older not platform specific version" do
+ build_repo4 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2" do |s|
+ s.platform = mingw
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2"
+ end
+
+ simulate_platform mingw do
+ install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
+ ruby "#{RUBY_VERSION}"
+ source "http://localgemserver.test/"
+ gem 'rack'
+ G
+ end
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ expect(out).to_not include("rack-1.2-#{Bundler.local_platform} requires ruby version > 9000")
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
end
context "allows no gems" do
@@ -150,9 +195,18 @@ RSpec.describe "bundle install with install-time dependencies" do
let(:ruby_requirement) { %("#{RUBY_VERSION}") }
let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" }
+ let(:error_message_platform) do
+ if Bundler.feature_flag.specific_platform?
+ " #{Bundler.local_platform}"
+ else
+ ""
+ end
+ end
shared_examples_for "ruby version conflicts" do
it "raises an error during resolution" do
+ skip "ruby requirement includes platform and it shouldn't" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
source "http://localgemserver.test/"
ruby #{ruby_requirement}
@@ -164,9 +218,9 @@ RSpec.describe "bundle install with install-time dependencies" do
nice_error = strip_whitespace(<<-E).strip
Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- Ruby\0 (#{error_message_requirement})
+ Ruby\0 (#{error_message_requirement})#{error_message_platform}
- require_ruby was resolved to 1.0, which depends on
+ require_ruby#{error_message_platform} was resolved to 1.0, which depends on
Ruby\0 (> 9000)
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
@@ -179,7 +233,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a < requirement" do
let(:ruby_requirement) { %("< 5000") }
- let(:error_message_requirement) { "< 5000" }
+ let(:error_message_requirement) { Gem::Requirement.new(["< 5000", "= #{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"]).to_s }
it_behaves_like "ruby version conflicts"
end
@@ -187,7 +241,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a compound requirement" do
let(:reqs) { ["> 0.1", "< 5000"] }
let(:ruby_requirement) { reqs.map(&:dump).join(", ") }
- let(:error_message_requirement) { Gem::Requirement.new(reqs).to_s }
+ let(:error_message_requirement) { Gem::Requirement.new(reqs + ["= #{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"]).to_s }
it_behaves_like "ruby version conflicts"
end