[rubygems/rubygems] Stop allowing calling #gem on random objects

4b8570ae15
This commit is contained in:
David Rodríguez 2025-07-02 10:39:12 +02:00 committed by Hiroshi SHIBATA
parent 845e878f88
commit 6a5808965b
6 changed files with 1 additions and 27 deletions

View file

@ -1524,22 +1524,7 @@ end
end
describe "after setup" do
it "allows calling #gem on random objects" do
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"
G
ruby <<-RUBY
require "bundler/setup"
Object.new.gem "myrack"
puts Gem.loaded_specs["myrack"].full_name
RUBY
expect(out).to eq("myrack-1.0.0")
end
it "keeps Kernel#gem private", bundler: "4" do
it "keeps Kernel#gem private" do
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"