summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-01-31 17:45:12 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-02-01 08:09:23 +0900
commit517d7c3221e3ca0ca76d79cc67cb9efefc01ece3 (patch)
treec7080febcd179b0e4f18cac553116164ebc9749a /spec
parent2b2e3b79919c153c3022115ccca24a80a2b57899 (diff)
Sync latest Bundler & RubyGems
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5512
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/binstubs_spec.rb8
-rw-r--r--spec/bundler/commands/cache_spec.rb16
-rw-r--r--spec/bundler/commands/clean_spec.rb7
-rw-r--r--spec/bundler/commands/lock_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb71
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb10
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb7
-rw-r--r--spec/bundler/runtime/inline_spec.rb2
-rw-r--r--spec/bundler/support/hax.rb10
-rw-r--r--spec/bundler/support/path.rb12
11 files changed, 114 insertions, 45 deletions
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 9e446ff267..198226207b 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -182,7 +182,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
context "and the version is older and the same major" do
- let(:system_bundler_version) { "2.3.3" }
+ let(:system_bundler_version) { "2.999.999" }
before do
lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 2.3.0")
@@ -191,7 +191,7 @@ RSpec.describe "bundle binstubs <gem>" do
it "installs and runs the exact version of bundler", :rubygems => ">= 3.3.0.dev" do
sys_exec "bin/bundle install --verbose", :artifice => "vcr"
expect(exitstatus).not_to eq(42)
- expect(out).to include("Bundler 2.3.3 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.")
+ expect(out).to include("Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.")
expect(out).to include("Using bundler 2.3.0")
expect(err).not_to include("Activating bundler (~> 2.3.0) failed:")
end
@@ -199,8 +199,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "runs the available version of bundler", :rubygems => "< 3.3.0.dev" do
sys_exec "bin/bundle install --verbose"
expect(exitstatus).not_to eq(42)
- expect(out).not_to include("Bundler 2.3.3 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.")
- expect(out).to include("Using bundler 2.3.3")
+ expect(out).not_to include("Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.")
+ expect(out).to include("Using bundler 2.999.999")
expect(err).not_to include("Activating bundler (~> 2.3.0) failed:")
end
end
diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb
index 4f9c1c26c4..356a658e7c 100644
--- a/spec/bundler/commands/cache_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -403,14 +403,14 @@ RSpec.describe "bundle install with gem sources" do
simulate_new_machine
- simulate_platform "ruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "platform_specific"
- G
- run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
- expect(out).to eq("1.0.0 RUBY")
- end
+ bundle "config set --local force_ruby_platform true"
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "platform_specific"
+ G
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
+ expect(out).to eq("1.0.0 RUBY")
end
it "does not update the cache if --no-cache is passed" do
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index 65231b35fa..576872b0f6 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -638,7 +638,12 @@ RSpec.describe "bundle clean" do
s.executables = "irb"
end
- realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
+ if Gem.win_platform? && RUBY_VERSION < "3.1.0"
+ default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
+ realworld_system_gems "fiddle --version #{default_fiddle_version}"
+ end
+
+ realworld_system_gems "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index 22709f4528..131b46de0d 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -337,7 +337,8 @@ RSpec.describe "bundle lock" do
#{Bundler::VERSION}
G
- simulate_platform(rb) { bundle :lock }
+ bundle "config set --local force_ruby_platform true"
+ bundle :lock
expect(lockfile).to eq <<~G
GEM
@@ -509,6 +510,11 @@ RSpec.describe "bundle lock" do
s.platform = "x64-mingw32"
s.required_ruby_version = "< #{next_minor}.dev"
end
+
+ build_gem "raygun-apm", "1.0.78" do |s|
+ s.platform = "x64-mingw-ucrt"
+ s.required_ruby_version = "< #{next_minor}.dev"
+ end
end
gemfile <<-G
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index e7cf8f08d2..6bcfadab7e 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -429,13 +429,16 @@ RSpec.describe "bundle install from an existing gemspec" do
gemspec
G
- simulate_platform("ruby") { bundle "install" }
+ bundle "config set --local force_ruby_platform true"
+ bundle "install"
+
+ simulate_new_machine
simulate_platform("jruby") { bundle "install" }
end
context "on ruby" do
before do
- simulate_platform("ruby")
+ bundle "config set --local force_ruby_platform true"
bundle :install
end
@@ -546,7 +549,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "installs the ruby platform gemspec" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -557,7 +560,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
bundle "config set --local without development"
install_gemfile <<-G
@@ -622,4 +625,64 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(lockfile).to eq initial_lockfile
end
end
+
+ context "with multiple locked platforms" do
+ before do
+ build_lib("activeadmin", :path => tmp.join("activeadmin")) do |s|
+ s.version = "2.9.0"
+ s.add_dependency "railties", ">= 5.2", "< 6.2"
+ end
+
+ build_repo4 do
+ build_gem "railties", "6.1.4"
+
+ build_gem "jruby-openssl", "0.10.7" do |s|
+ s.platform = "java"
+ end
+ end
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo4)}"
+ gemspec :path => "../activeadmin"
+ gem "jruby-openssl", :platform => :jruby
+ G
+
+ bundle "lock --add-platform java"
+ end
+
+ it "does not remove the platform specific specs from the lockfile when re-resolving due to gemspec changes" do
+ expect(lockfile).to eq <<~L
+ PATH
+ remote: ../activeadmin
+ specs:
+ activeadmin (2.9.0)
+ railties (>= 5.2, < 6.2)
+
+ GEM
+ remote: #{file_uri_for(gem_repo4)}/
+ specs:
+ jruby-openssl (0.10.7-java)
+ railties (6.1.4)
+
+ PLATFORMS
+ #{lockfile_platforms_for(["java"] + local_platforms)}
+
+ DEPENDENCIES
+ activeadmin!
+ jruby-openssl
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ gemspec = tmp.join("activeadmin/activeadmin.gemspec")
+ File.write(gemspec, File.read(gemspec).sub(">= 5.2", ">= 6.0"))
+
+ previous_lockfile = lockfile
+
+ bundle "install --local"
+
+ expect(lockfile).to eq(previous_lockfile.sub(">= 5.2", ">= 6.0"))
+ end
+ end
end
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index e4a5f7a8ff..365a84f39e 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -92,9 +92,7 @@ RSpec.describe "bundle install with git sources" do
expect(err).to include("The source contains the following gems matching 'foo':\n * foo-1.0")
end
- it "complains with version and platform if pinned specs don't exist in the git repo" do
- simulate_platform "java"
-
+ it "complains with version and platform if pinned specs don't exist in the git repo", :jruby do
build_git "only_java" do |s|
s.platform = "java"
end
@@ -109,9 +107,7 @@ RSpec.describe "bundle install with git sources" do
expect(err).to include("The source contains the following gems matching 'only_java':\n * only_java-1.0-java")
end
- it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do
- simulate_platform "java"
-
+ it "complains with multiple versions and platforms if pinned specs don't exist in the git repo", :jruby do
build_git "only_java", "1.0" do |s|
s.platform = "java"
end
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index 35a3872c03..839db0089e 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -86,13 +86,13 @@ RSpec.describe "bundle install across platforms" do
expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
simulate_new_machine
-
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
bundle "install"
expect(the_bundle).to include_gems "nokogiri 1.4.2"
expect(the_bundle).not_to include_gems "weakling"
+ simulate_new_machine
simulate_platform "java"
bundle "install"
@@ -453,7 +453,7 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "does not attempt to install gems from :rbx when using --local" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -465,7 +465,7 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "does not attempt to install gems from other rubies when using --local" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
other_ruby_version_tag = RUBY_VERSION =~ /^1\.8/ ? :ruby_19 : :ruby_18
gemfile <<-G
@@ -478,7 +478,7 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "does not print a warning when a dependency is unused on a platform different from the current one" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index 337d5f021c..0c77e883df 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -113,7 +113,12 @@ RSpec.shared_examples "bundle install --standalone" do
skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
- realworld_system_gems "fiddle --version 1.0.8", "tsort --version 0.1.0"
+ if Gem.win_platform? && RUBY_VERSION < "3.1.0"
+ default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
+ realworld_system_gems "fiddle --version #{default_fiddle_version}"
+ end
+
+ realworld_system_gems "tsort --version 0.1.0"
necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "yaml --version 0.1.1", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.0"]
necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.a")
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 2ffadebf55..24df758619 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -309,7 +309,7 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "skips platform warnings" do
- simulate_platform "ruby"
+ bundle "config set --local force_ruby_platform true"
script <<-RUBY
gemfile(true) do
diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index 4a49ffb49f..3d97b93c5a 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -19,16 +19,6 @@ module Gem
@local = new(ENV["BUNDLER_SPEC_PLATFORM"])
end
@platforms = [Gem::Platform::RUBY, Gem::Platform.local]
-
- if ENV["BUNDLER_SPEC_PLATFORM"] == "ruby"
- class << self
- remove_method :finish_resolve
-
- def finish_resolve
- []
- end
- end
- end
end
if ENV["BUNDLER_SPEC_GEM_SOURCES"]
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 3304c69c78..41b36997b2 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -30,7 +30,7 @@ module Spec
end
def test_gemfile
- @test_gemfile ||= source_root.join("tool/bundler/test_gems.rb")
+ @test_gemfile ||= tool_dir.join("test_gems.rb")
end
def rubocop_gemfile
@@ -42,7 +42,7 @@ module Spec
end
def dev_gemfile
- @dev_gemfile ||= git_root.join("dev_gems.rb")
+ @dev_gemfile ||= tool_dir.join("dev_gems.rb")
end
def bindir
@@ -294,7 +294,7 @@ module Spec
else
"rubocop_gems"
end
- source_root.join("tool/bundler/#{filename}.rb")
+ tool_dir.join("#{filename}.rb")
end
def standard_gemfile_basename
@@ -305,7 +305,11 @@ module Spec
else
"standard_gems"
end
- source_root.join("tool/bundler/#{filename}.rb")
+ tool_dir.join("#{filename}.rb")
+ end
+
+ def tool_dir
+ source_root.join("tool/bundler")
end
extend self