diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-10-26 22:12:02 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-11-13 11:06:10 +0900 |
| commit | 50482cd1e5542f210565440bed7586821f774a29 (patch) | |
| tree | 78ea56dcf75b96116fc6bb5fd3dd4b6cfdd72316 /spec | |
| parent | 54511303a46901a82e9b2d4ee460b2048e59a2e5 (diff) | |
[rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in Bundler
https://github.com/rubygems/rubygems/commit/93619c97ff
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/bundler/shared_helpers_spec.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/bundler/specifications/foo.gemspec | 2 | ||||
| -rw-r--r-- | spec/bundler/commands/clean_spec.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/commands/exec_spec.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/install/gemfile/sources_spec.rb | 8 | ||||
| -rw-r--r-- | spec/bundler/install/gems/compact_index_spec.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/install/gems/dependency_api_spec.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/install/gems/standalone_spec.rb | 1 | ||||
| -rw-r--r-- | spec/bundler/install/global_cache_spec.rb | 6 | ||||
| -rw-r--r-- | spec/bundler/lock/lockfile_spec.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/other/major_deprecation_spec.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/resolver/platform_spec.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/runtime/inline_spec.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 6 | ||||
| -rw-r--r-- | spec/bundler/runtime/with_unbundled_env_spec.rb | 8 | ||||
| -rw-r--r-- | spec/bundler/spec_helper.rb | 1 | ||||
| -rw-r--r-- | spec/bundler/support/helpers.rb | 28 | ||||
| -rw-r--r-- | spec/bundler/support/path.rb | 7 |
18 files changed, 22 insertions, 71 deletions
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb index 917f22c10d..ae44e48c71 100644 --- a/spec/bundler/bundler/shared_helpers_spec.rb +++ b/spec/bundler/bundler/shared_helpers_spec.rb @@ -248,8 +248,6 @@ RSpec.describe Bundler::SharedHelpers do shared_examples_for "ENV['BUNDLER_SETUP'] gets set correctly" do it "ensures bundler/setup is set in ENV['BUNDLER_SETUP']" do - skip "Does not play well with DidYouMean being a bundled gem instead of a default gem in Ruby 2.6" if RUBY_VERSION < "2.7" - subject.set_bundle_environment expect(ENV["BUNDLER_SETUP"]).to eq("#{source_lib_dir}/bundler/setup") end diff --git a/spec/bundler/bundler/specifications/foo.gemspec b/spec/bundler/bundler/specifications/foo.gemspec index 3628dafc29..46eb068cd1 100644 --- a/spec/bundler/bundler/specifications/foo.gemspec +++ b/spec/bundler/bundler/specifications/foo.gemspec @@ -8,6 +8,6 @@ Gem::Specification.new do |s| s.version = "1.0.0" s.loaded_from = __FILE__ s.extensions = "ext/foo" - s.required_ruby_version = ">= 2.6.0" + s.required_ruby_version = ">= 3.0.0" end # rubocop:enable Style/FrozenStringLiteralComment diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 62add30252..29c94029db 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -626,8 +626,6 @@ RSpec.describe "bundle clean" do end it "when using --force, it doesn't remove default gem binaries", :realworld do - 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" - 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 default_irb_version = ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", :raise_on_error => false diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 7217c9d61f..14255dff60 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -616,7 +616,7 @@ RSpec.describe "bundle exec" do end it "loads the correct optparse when `auto_install` is set, and optparse is a dependency" do - if Gem.ruby_version >= Gem::Version.new("3.0.0") && Gem.rubygems_version < Gem::Version.new("3.3.0.a") + if Gem.rubygems_version < Gem::Version.new("3.3.0.a") skip "optparse is a default gem, and rubygems loads it during install" end diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 15ff15e46d..bc6929ef73 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -1582,11 +1582,9 @@ RSpec.describe "bundle install with gems on multiple sources" do end G - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - ruby <<~R, :raise_on_error => false - require 'bundler/setup' - R - end + ruby <<~R, :raise_on_error => false + require 'bundler/setup' + R expect(last_command).to be_failure expect(err).to include("Could not find gem 'example' in locally installed gems.") diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 305d253def..b2ed9565a4 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -416,7 +416,7 @@ The checksum of /versions does not match the checksum provided by the server! So FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "compact_index_extra_missing", :env => env_for_missing_prerelease_default_gem_activation + install_gemfile <<-G, :artifice => "compact_index_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" @@ -436,7 +436,7 @@ The checksum of /versions does not match the checksum provided by the server! So FileUtils.rm_rf Dir[gem_repo4("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "compact_index_extra_api_missing", :env => env_for_missing_prerelease_default_gem_activation + install_gemfile <<-G, :artifice => "compact_index_extra_api_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index a54f1db772..c379e5ea8f 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -369,7 +369,7 @@ RSpec.describe "gemcutter's dependency API" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "endpoint_extra_missing", :env => env_for_missing_prerelease_default_gem_activation + install_gemfile <<-G, :artifice => "endpoint_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" gem "back_deps" @@ -388,7 +388,7 @@ RSpec.describe "gemcutter's dependency API" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "endpoint_extra_missing", :env => env_for_missing_prerelease_default_gem_activation + install_gemfile <<-G, :artifice => "endpoint_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index edb7a0e6bc..4929c45337 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -142,7 +142,6 @@ RSpec.shared_examples "bundle install --standalone" do describe "with default gems and a lockfile", :ruby_repo do before 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 "tsort --version 0.1.0" diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb index be34d8b5bc..be43dc5963 100644 --- a/spec/bundler/install/global_cache_spec.rb +++ b/spec/bundler/install/global_cache_spec.rb @@ -193,10 +193,8 @@ RSpec.describe "global gem caching" do bundle :install, :artifice => "compact_index_no_gem", :dir => bundled_app2 # activesupport is installed and both are in the global cache - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2 - expect(the_bundle).to include_gems "activesupport 2.3.5", :dir => bundled_app2 - end + expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2 + expect(the_bundle).to include_gems "activesupport 2.3.5", :dir => bundled_app2 expect(source_global_cache("rack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index efa5b85788..c7c16f7077 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -1712,9 +1712,7 @@ RSpec.describe "the lockfile format" do expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).to match("\r\n") - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - expect(the_bundle).to include_gems "rack 1.2" - end + expect(the_bundle).to include_gems "rack 1.2" end end diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 7b7ceb4586..293c04d60a 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -519,7 +519,7 @@ RSpec.describe "major deprecations" do context "when `bundler/deployment` is required in a ruby script" do before do - ruby(<<-RUBY, :env => env_for_missing_prerelease_default_gem_activation) + ruby <<-RUBY require 'bundler/deployment' RUBY end diff --git a/spec/bundler/resolver/platform_spec.rb b/spec/bundler/resolver/platform_spec.rb index a710dfcb28..3e959aeb89 100644 --- a/spec/bundler/resolver/platform_spec.rb +++ b/spec/bundler/resolver/platform_spec.rb @@ -82,7 +82,7 @@ RSpec.describe "Resolving platform craziness" do should_resolve_as %w[foo-1.0.0-x64-mingw32] end - describe "on a linux platform", :rubygems => ">= 3.1.0.pre.1" do + describe "on a linux platform" do # Ruby's platform is *-linux => platform's libc is glibc, so not musl # Ruby's platform is *-linux-musl => platform's libc is musl, so not glibc # Gem's platform is *-linux => gem is glibc + maybe musl compatible diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb index 29ef036828..6fcbb68cb2 100644 --- a/spec/bundler/runtime/inline_spec.rb +++ b/spec/bundler/runtime/inline_spec.rb @@ -89,7 +89,7 @@ RSpec.describe "bundler/inline#gemfile" do expect(out).to include("Installing activesupport") err_lines = err.split("\n") - err_lines.reject! {|line| line =~ /\.rb:\d+: warning: / } unless RUBY_VERSION < "2.7" + err_lines.reject! {|line| line =~ /\.rb:\d+: warning: / } expect(err_lines).to be_empty end @@ -595,8 +595,6 @@ RSpec.describe "bundler/inline#gemfile" do dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", :raise_on_error => false skip "does not work if rubygems/dependency_installer loads fileutils, which happens until rubygems 3.2.0" unless dependency_installer_loads_fileutils.empty? - skip "pathname does not install cleanly on this ruby" if RUBY_VERSION < "2.7.0" - Dir.mkdir tmp("path_without_gemfile") default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", :raise_on_error => false diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 3abbea449b..1b1e78f6b2 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1279,8 +1279,6 @@ end describe "with gemified standard libraries" do it "does not load Digest", :ruby_repo do - skip "Only for Ruby 3.0+" unless RUBY_VERSION >= "3.0" - build_git "bar", :gemspec => false do |s| s.write "lib/bar/version.rb", %(BAR_VERSION = '1.0') s.write "bar.gemspec", <<-G @@ -1339,9 +1337,7 @@ end describe "default gem activation" do let(:exemptions) do - exempts = %w[did_you_mean bundler] - exempts << "uri" if Gem.ruby_version >= Gem::Version.new("2.7") - exempts << "pathname" if Gem.ruby_version >= Gem::Version.new("3.0") + exempts = %w[did_you_mean bundler uri pathname] exempts << "etc" if Gem.ruby_version < Gem::Version.new("3.2") && Gem.win_platform? exempts << "set" unless Gem.rubygems_version >= Gem::Version.new("3.2.6") exempts << "tsort" unless Gem.rubygems_version >= Gem::Version.new("3.2.31") diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb index 731a9921a2..fa6140713d 100644 --- a/spec/bundler/runtime/with_unbundled_env_spec.rb +++ b/spec/bundler/runtime/with_unbundled_env_spec.rb @@ -90,9 +90,7 @@ RSpec.describe "Bundler.with_env helpers" do RUBY setup_require = "-r#{lib_dir}/bundler/setup" ENV["BUNDLER_ORIG_RUBYOPT"] = "-W2 #{setup_require} #{ENV["RUBYOPT"]}" - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - bundle_exec_ruby bundled_app("source.rb") - end + bundle_exec_ruby bundled_app("source.rb") expect(last_command.stdboth).not_to include(setup_require) end @@ -101,9 +99,7 @@ RSpec.describe "Bundler.with_env helpers" do print #{modified_env}['RUBYOPT'] RUBY ENV["BUNDLER_ORIG_RUBYOPT"] = "-W2 -rbundler/setup #{ENV["RUBYOPT"]}" - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - bundle_exec_ruby bundled_app("source.rb") - end + bundle_exec_ruby bundled_app("source.rb") expect(last_command.stdboth).not_to include("-rbundler/setup") end diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index afbf053636..6d61ef899f 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -77,7 +77,6 @@ RSpec.configure do |config| require_relative "support/rubygems_ext" Spec::Rubygems.test_setup ENV["BUNDLER_SPEC_RUN"] = "true" - ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"] = "true" ENV["BUNDLE_USER_CONFIG"] = ENV["BUNDLE_USER_CACHE"] = ENV["BUNDLE_USER_PLUGIN"] = nil ENV["BUNDLE_APP_CONFIG"] = nil ENV["BUNDLE_SILENCE_ROOT_WARNING"] = nil diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index f4dd6fc89b..88f34a7028 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -464,32 +464,12 @@ module Spec old = ENV["BUNDLER_SPEC_WINDOWS"] ENV["BUNDLER_SPEC_WINDOWS"] = "true" simulate_platform platform do - simulate_bundler_version_when_missing_prerelease_default_gem_activation do - yield - end + yield end ensure ENV["BUNDLER_SPEC_WINDOWS"] = old end - def simulate_bundler_version_when_missing_prerelease_default_gem_activation - return yield unless rubygems_version_failing_to_activate_bundler_prereleases - - old = ENV["BUNDLER_VERSION"] - ENV["BUNDLER_VERSION"] = Bundler::VERSION - yield - ensure - ENV["BUNDLER_VERSION"] = old - end - - def env_for_missing_prerelease_default_gem_activation - if rubygems_version_failing_to_activate_bundler_prereleases - { "BUNDLER_VERSION" => Bundler::VERSION } - else - {} - end - end - def current_ruby_minor Gem.ruby_version.segments.tap {|s| s.delete_at(2) }.join(".") end @@ -508,12 +488,6 @@ module Spec Gem.ruby_version.segments[0..1] end - # versions not including - # https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1 - def rubygems_version_failing_to_activate_bundler_prereleases - Gem.rubygems_version < Gem::Version.new("3.1.0.pre.1") - end - def revision_for(path) sys_exec("git rev-parse HEAD", :dir => path).strip end diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 240cfe7bc9..8b9c0e1290 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -42,8 +42,7 @@ module Spec end def dev_gemfile - name = RUBY_VERSION.start_with?("2.6") ? "dev26_gems.rb" : "dev_gems.rb" - @dev_gemfile ||= tool_dir.join(name) + @dev_gemfile ||= tool_dir.join("dev_gems.rb") end def bindir @@ -292,11 +291,11 @@ module Spec end def rubocop_gemfile_basename - tool_dir.join(RUBY_VERSION.start_with?("2.6") ? "rubocop26_gems.rb" : "rubocop_gems.rb") + tool_dir.join("rubocop_gems.rb") end def standard_gemfile_basename - tool_dir.join(RUBY_VERSION.start_with?("2.6") ? "standard26_gems.rb" : "standard_gems.rb") + tool_dir.join("standard_gems.rb") end def tool_dir |
