Skip to content

Commit 0ec091c

Browse files
committed
Add a test demonstrating current behavior with platform specific variant
1 parent 252d8f6 commit 0ec091c

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

spec/install/gemfile/specific_platform_spec.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,50 @@
261261
expect(the_bundle).not_to include_gem("nokogiri 1.18.10 x86_64-linux")
262262
end
263263
end
264+
265+
it "installs the ruby variant but Bundler.setup still complains when only an incompatible platform-specific variant is locked" do
266+
build_repo4 do
267+
build_gem "nokogiri", "1.18.10"
268+
build_gem "nokogiri", "1.18.10" do |s|
269+
s.platform = "x86_64-linux"
270+
s.required_ruby_version = "< #{Gem.ruby_version}"
271+
end
272+
end
273+
274+
gemfile <<~G
275+
source "https://gem.repo4"
276+
277+
gem "nokogiri"
278+
G
279+
280+
lockfile <<-L
281+
GEM
282+
remote: https://gem.repo4/
283+
specs:
284+
nokogiri (1.18.10-x86_64-linux)
285+
286+
PLATFORMS
287+
x86_64-linux
288+
289+
DEPENDENCIES
290+
nokogiri
291+
292+
BUNDLED WITH
293+
#{Bundler::VERSION}
294+
L
295+
296+
simulate_platform "x86_64-linux" do
297+
bundle "install --verbose", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false
298+
expect(exitstatus).to eq(0)
299+
expect(out).to include("Fetching nokogiri 1.18.10\n")
300+
expect(out).to include("Installing nokogiri 1.18.10\n")
301+
302+
# FIXME: We should not install an alternative and then refuse to use it.
303+
ruby "require 'bundler'; Bundler.setup", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false
304+
expect(exitstatus).not_to eq(0)
305+
expect(err).to include("Could not find nokogiri-1.18.10-x86_64-linux in locally installed gems")
306+
end
307+
end
264308
end
265309

266310
it "doesn't discard previously installed platform specific gem and fall back to ruby on subsequent bundles" do

0 commit comments

Comments
 (0)