diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-08-30 13:44:06 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-08-30 20:47:59 -0500 |
commit | 789974c1d3e08830b49d7517b943d33d24ed2192 (patch) | |
tree | 184360ac140851f3ee312006c80965636d4d69a0 /spec/install/gemfile | |
parent | 570012724216e8a4f8cd2ffe9eb8acdfc94be133 (diff) | |
download | bundler-789974c1d3e08830b49d7517b943d33d24ed2192.tar.gz |
[Resolver] Error when it is ambigous which transitive source a gem should come fromseg-multisource-error
Diffstat (limited to 'spec/install/gemfile')
-rw-r--r-- | spec/install/gemfile/sources_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb index 0b837f87a1..8d69a663de 100644 --- a/spec/install/gemfile/sources_spec.rb +++ b/spec/install/gemfile/sources_spec.rb @@ -545,7 +545,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "does not re-resolve" do - bundle :install, :verbose => true + bundle! :install, :verbose => true expect(out).to include("using resolution from the lockfile") expect(out).not_to include("re-resolving dependencies") end @@ -617,4 +617,31 @@ RSpec.describe "bundle install with gems on multiple sources" do end end end + + context "when a gem is available from multiple ambiguous sources", :bundler => "2" do + it "raises, suggesting a source block" do + build_repo4 do + build_gem "depends_on_rack" do |s| + s.add_dependency "rack" + end + build_gem "rack" + end + + install_gemfile <<-G + source "file:#{gem_repo4}" + source "file:#{gem_repo1}" do + gem "thin" + end + gem "depends_on_rack" + G + expect(last_command).to be_failure + expect(last_command.stderr).to eq strip_whitespace(<<-EOS).strip + The gem 'rack' was found in multiple relevant sources. + * rubygems repository file:#{gem_repo1}/ or installed locally + * rubygems repository file:#{gem_repo4}/ or installed locally + You must add this gem to the source block for the source you wish it to be installed from. + EOS + expect(the_bundle).not_to be_locked + end + end end |