From b86a7ba49252e00e19c22bbcdc821b5acc31ff92 Mon Sep 17 00:00:00 2001 From: David Rodríguez Date: Mon, 20 Dec 2021 19:54:08 +0100 Subject: [rubygems/rubygems] Fix error when gem specified twice in gemfile under different platforms https://github.com/rubygems/rubygems/commit/83bc87ca98 --- spec/bundler/commands/install_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/bundler') diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 918dc28acb..dd4d31a1ad 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -391,6 +391,22 @@ RSpec.describe "bundle install with gem sources" do expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.") end + it "throws a warning if a gem is added twice under different platforms and does not crash when using the generated lockfile" do + build_repo2 + + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "rack", :platform => :jruby + gem "rack" + G + + bundle "install" + + expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.") + expect(err).to include("Remove any duplicate entries and specify the gem only once.") + expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.") + end + it "does not throw a warning if a gem is added once in Gemfile and also inside a gemspec as a development dependency" do build_lib "my-gem", :path => bundled_app do |s| s.add_development_dependency "my-private-gem" -- cgit v1.2.3