aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-11-23 22:06:19 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-27 15:04:40 +0900
commit60803e192eebd1048f28ea5ba2a2f2c753424dad (patch)
treedf4fb3a910cdec5a00d97defaed3d1a9a73f4c98 /spec
parent67ee91a3058e9d918add38ed02205e7383f00fad (diff)
downloadruby-60803e192eebd1048f28ea5ba2a2f2c753424dad.tar.gz
[rubygems/rubygems] Remove no longer necessary workaround for old RubyGems
https://github.com/rubygems/rubygems/commit/ed4eaefac0
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/config_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb2
-rw-r--r--spec/bundler/lock/lockfile_spec.rb2
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb2
-rw-r--r--spec/bundler/realworld/double_check_spec.rb4
-rw-r--r--spec/bundler/runtime/inline_spec.rb16
-rw-r--r--spec/bundler/runtime/load_spec.rb2
-rw-r--r--spec/bundler/runtime/platform_spec.rb2
-rw-r--r--spec/bundler/runtime/require_spec.rb2
-rw-r--r--spec/bundler/runtime/setup_spec.rb12
-rw-r--r--spec/bundler/support/helpers.rb2
-rw-r--r--spec/bundler/support/path.rb7
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb3
13 files changed, 26 insertions, 34 deletions
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index ede93f99eb..99f9423c22 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -443,7 +443,7 @@ E
expect(err).to be_empty
ruby(<<~RUBY)
- require "#{entrypoint}"
+ require "bundler"
print Bundler.settings.mirror_for("https://rails-assets.org")
RUBY
expect(out).to eq("https://rails-assets.org/")
@@ -451,7 +451,7 @@ E
bundle "config set mirror.all http://localhost:9293"
ruby(<<~RUBY)
- require "#{entrypoint}"
+ require "bundler"
print Bundler.settings.mirror_for("https://rails-assets.org")
RUBY
expect(out).to eq("http://localhost:9293/")
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 734e012e84..5dd39ee921 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -349,7 +349,7 @@ RSpec.describe "bundle install with groups" do
G
ruby <<-R
- require "#{entrypoint}"
+ require "bundler"
Bundler.setup :default
Bundler.require :default
puts RACK
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index c7c16f7077..455315dab7 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -1733,7 +1733,7 @@ RSpec.describe "the lockfile format" do
expect do
ruby <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
Bundler.setup
RUBY
end.not_to change { File.mtime(bundled_app_lock) }
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index 293c04d60a..baec67ec34 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -503,7 +503,7 @@ RSpec.describe "major deprecations" do
G
ruby <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
Bundler.setup
Bundler.setup
diff --git a/spec/bundler/realworld/double_check_spec.rb b/spec/bundler/realworld/double_check_spec.rb
index d7f28d10bb..cfeba26e53 100644
--- a/spec/bundler/realworld/double_check_spec.rb
+++ b/spec/bundler/realworld/double_check_spec.rb
@@ -25,9 +25,9 @@ RSpec.describe "double checking sources", :realworld => true do
RUBY
cmd = <<-RUBY
- require "#{entrypoint}"
+ require "bundler"
require "#{spec_dir}/support/artifice/vcr"
- require "#{entrypoint}/inline"
+ require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails", path: "."
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 6fcbb68cb2..6dffd6d32b 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundler/inline#gemfile" do
def script(code, options = {})
- requires = ["#{entrypoint}/inline"]
+ requires = ["bundler/inline"]
requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice)
requires = requires.map {|r| "require '#{r}'" }.join("\n")
ruby("#{requires}\n\n" + code, options)
@@ -95,7 +95,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "lets me use my own ui object" do
script <<-RUBY, :artifice => "endpoint"
- require '#{entrypoint}'
+ require 'bundler'
class MyBundlerUI < Bundler::UI::Shell
def confirm(msg, newline = nil)
puts "CONFIRMED!"
@@ -114,7 +114,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "has an option for quiet installation" do
script <<-RUBY, :artifice => "endpoint"
- require '#{entrypoint}/inline'
+ require 'bundler/inline'
gemfile(true, :quiet => true) do
source "https://notaserver.com"
@@ -140,7 +140,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "does not mutate the option argument" do
script <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
options = { :ui => Bundler::UI::Shell.new }
gemfile(false, options) do
source "#{file_uri_for(gem_repo1)}"
@@ -259,7 +259,7 @@ RSpec.describe "bundler/inline#gemfile" do
system_gems "rack-1.0.0"
script <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
ui = Bundler::UI::Shell.new
ui.level = "confirm"
@@ -279,7 +279,7 @@ RSpec.describe "bundler/inline#gemfile" do
system_gems "rack-1.0.0"
script <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
ui = Bundler::UI::Shell.new
ui.level = "confirm"
gemfile(true, ui: ui) do
@@ -302,7 +302,7 @@ RSpec.describe "bundler/inline#gemfile" do
system_gems "rack-1.0.0"
script <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
ui = Bundler::UI::Shell.new
ui.level = "confirm"
gemfile(true, ui: ui) do
@@ -339,7 +339,7 @@ RSpec.describe "bundler/inline#gemfile" do
end
script <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
ui = Bundler::UI::Shell.new
ui.level = "confirm"
gemfile(true, ui: ui) do
diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb
index 96a22a46cc..f28ffd9460 100644
--- a/spec/bundler/runtime/load_spec.rb
+++ b/spec/bundler/runtime/load_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe "Bundler.load" do
G
ruby <<-RUBY
- require "#{entrypoint}"
+ require "bundler"
Bundler.setup :default
Bundler.require :default
puts RACK
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index 31d93a559f..82120f75b2 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
ruby <<-R
begin
- require '#{entrypoint}'
+ require 'bundler'
Bundler.ui.silence { Bundler.setup }
rescue Bundler::GemNotFound => e
puts "WIN"
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index e59fa564f6..61dbd303f7 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -199,7 +199,7 @@ RSpec.describe "Bundler.require" do
G
cmd = <<-RUBY
- require '#{entrypoint}'
+ require 'bundler'
Bundler.require
RUBY
ruby(cmd)
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 6c414ccb5d..859b7a890a 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -194,7 +194,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R
- require '#{entrypoint}'
+ require 'bundler'
begin
Bundler.setup
@@ -441,7 +441,7 @@ RSpec.describe "Bundler.setup" do
break_git!
ruby <<-R
- require "#{entrypoint}"
+ require "bundler"
begin
Bundler.setup
@@ -1187,7 +1187,7 @@ end
context "is not present" do
it "does not change the lock" do
lockfile lock_with(nil)
- ruby "require '#{entrypoint}/setup'"
+ ruby "require 'bundler/setup'"
expect(lockfile).to eq lock_with(nil)
end
end
@@ -1206,7 +1206,7 @@ end
it "does not change the lock" do
system_gems "bundler-1.10.1"
lockfile lock_with("1.10.1")
- ruby "require '#{entrypoint}/setup'"
+ ruby "require 'bundler/setup'"
expect(lockfile).to eq lock_with("1.10.1")
end
end
@@ -1304,7 +1304,7 @@ end
bundle :install
ruby <<-RUBY
- require '#{entrypoint}/setup'
+ require 'bundler/setup'
puts defined?(::Digest) ? "Digest defined" : "Digest undefined"
require 'digest'
RUBY
@@ -1314,7 +1314,7 @@ end
it "does not load Psych" do
gemfile "source \"#{file_uri_for(gem_repo1)}\""
ruby <<-RUBY
- require '#{entrypoint}/setup'
+ require 'bundler/setup'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
require 'psych'
puts Psych::VERSION
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index d63cf1e839..f873220f14 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -60,7 +60,7 @@ module Spec
def run(cmd, *args)
opts = args.last.is_a?(Hash) ? args.pop : {}
groups = args.map(&:inspect).join(", ")
- setup = "require '#{entrypoint}' ; Bundler.ui.silence { Bundler.setup(#{groups}) }"
+ setup = "require 'bundler' ; Bundler.ui.silence { Bundler.setup(#{groups}) }"
ruby([setup, cmd].join(" ; "), opts)
end
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 8b9c0e1290..23b8cc4180 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -225,13 +225,6 @@ module Spec
root.join("lib")
end
- # Sometimes rubygems version under test does not include
- # https://github.com/rubygems/rubygems/pull/2728 and will not always end up
- # activating the current bundler. In that case, require bundler absolutely.
- def entrypoint
- Gem.rubygems_version < Gem::Version.new("3.1.a") ? "#{lib_dir}/bundler" : "bundler"
- end
-
def global_plugin_gem(*args)
home ".bundle", "plugin", "gems", *args
end
diff --git a/spec/bundler/support/rubygems_version_manager.rb b/spec/bundler/support/rubygems_version_manager.rb
index 5653601ae8..cb670d60e5 100644
--- a/spec/bundler/support/rubygems_version_manager.rb
+++ b/spec/bundler/support/rubygems_version_manager.rb
@@ -30,11 +30,10 @@ class RubygemsVersionManager
rubygems_default_path = rubygems_path + "/defaults"
bundler_path = rubylibdir + "/bundler"
- bundler_exemptions = Gem.rubygems_version < Gem::Version.new("3.2.0") ? [bundler_path + "/errors.rb"] : []
bad_loaded_features = $LOADED_FEATURES.select do |loaded_feature|
(loaded_feature.start_with?(rubygems_path) && !loaded_feature.start_with?(rubygems_default_path)) ||
- (loaded_feature.start_with?(bundler_path) && !bundler_exemptions.any? {|bundler_exemption| loaded_feature.start_with?(bundler_exemption) })
+ loaded_feature.start_with?(bundler_path)
end
errors = if bad_loaded_features.any?