summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-12-14 14:29:04 +0100
committergit <svn-admin@ruby-lang.org>2021-12-17 16:35:18 +0900
commit79f72a4540212fd7d6af47f57d1a426ac99335bd (patch)
tree5266fe9ba1e254859e8b58ac1564c72baab098c6 /spec
parentc710cdb905a58b4ef0c7b5a9a8e867b382ccfd66 (diff)
[rubygems/rubygems] Fix crash when no matching variants are found for the current platform
If we are resolving a dependency against a particular platform, and there are no platform specific variants of the candidates that match that platform, we should not consider those candidates. https://github.com/rubygems/rubygems/commit/f6077fe27d
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index ce2823ce9a..3acc29041e 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -282,6 +282,26 @@ RSpec.describe "bundle install with specific platforms" do
bundle "install --verbose"
end
+ it "does not resolve if the current platform does not match any of available platform specific variants for a top level dependency" do
+ build_repo2 do
+ build_gem("sorbet-static", "0.5.6433") {|s| s.platform = "x86_64-linux" }
+ build_gem("sorbet-static", "0.5.6433") {|s| s.platform = "universal-darwin-20" }
+ end
+
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo2)}"
+
+ gem "sorbet-static", "0.5.6433"
+ G
+
+ simulate_platform "arm64-darwin-21" do
+ bundle "install", :raise_on_error => false
+ end
+
+ expect(err).to include("Could not find gem 'sorbet-static (= 0.5.6433) arm64-darwin-21' in rubygems repository #{file_uri_for(gem_repo2)}/ or installed locally.")
+ expect(err).to include("The source contains the following gems matching 'sorbet-static (= 0.5.6433)': sorbet-static-0.5.6433-universal-darwin-20, sorbet-static-0.5.6433-x86_64-linux")
+ end
+
private
def setup_multiplatform_gem