From 069b87daa547c90f0859b46bdb27442bc241836e Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Fri, 4 Sep 2020 22:27:55 +0200 Subject: [PATCH] Add bundler test for gems with platform-specific dependency having different requirements order --- bundler/spec/install/gemfile/platform_spec.rb | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bundler/spec/install/gemfile/platform_spec.rb b/bundler/spec/install/gemfile/platform_spec.rb index dd58aef29b1d..d9985614c7be 100644 --- a/bundler/spec/install/gemfile/platform_spec.rb +++ b/bundler/spec/install/gemfile/platform_spec.rb @@ -256,6 +256,35 @@ expect(the_bundle).not_to include_gem "CFPropertyList" end + it "works with gems with platform-specific dependency having different requirements order", :rubygems => '>= 3.2.0.rc.2' do + simulate_platform x64_mac + + update_repo2 do + build_gem "fspath", "3" + build_gem "image_optim_pack", "1.2.3" do |s| + s.add_runtime_dependency "fspath", ">= 2.1", "< 4" + end + build_gem "image_optim_pack", "1.2.3" do |s| + s.platform = "universal-darwin" + s.add_runtime_dependency "fspath", "< 4", ">= 2.1" + end + end + + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + G + + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + + gem "image_optim_pack" + G + + expect(err).not_to include "Unable to use the platform-specific" + + expect(the_bundle).to include_gem "image_optim_pack 1.2.3 universal-darwin" + end + it "fetches gems again after changing the version of Ruby" do gemfile <<-G source "#{file_uri_for(gem_repo1)}"