[rubygems/rubygems] Make sure to require "rubygems"
explicitly
This is also done in bundler/lib/bundler/rubygems_integration.rb, but bundler/lib/bundler.rb loads this file before it. https://github.com/rubygems/rubygems/commit/8840d8507b
This commit is contained in:
parent
50a5b76dec
commit
8e64c87f64
@ -2,6 +2,8 @@
|
||||
|
||||
require "pathname"
|
||||
|
||||
require "rubygems" unless defined?(Gem)
|
||||
|
||||
require "rubygems/specification"
|
||||
|
||||
# We can't let `Gem::Source` be autoloaded in the `Gem::Specification#source`
|
||||
|
15
spec/bundler/runtime/requiring_spec.rb
Normal file
15
spec/bundler/runtime/requiring_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "Requiring bundler" do
|
||||
it "takes care of requiring rubygems when entrypoint is bundler/setup" do
|
||||
sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler/setup -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) })
|
||||
|
||||
expect(last_command.stdboth).to eq("true")
|
||||
end
|
||||
|
||||
it "takes care of requiring rubygems when requiring just bundler" do
|
||||
sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) })
|
||||
|
||||
expect(last_command.stdboth).to eq("true")
|
||||
end
|
||||
end
|
@ -1506,12 +1506,6 @@ end
|
||||
expect(err).to include "private method `require'"
|
||||
end
|
||||
|
||||
it "takes care of requiring rubygems" do
|
||||
sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler/setup -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) })
|
||||
|
||||
expect(last_command.stdboth).to eq("true")
|
||||
end
|
||||
|
||||
it "memoizes initial set of specs when requiring bundler/setup, so that even if further code mutates dependencies, Bundler.definition.specs is not affected" do
|
||||
install_gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user