From 019c261cd7128a6b9d2a6dd977865af268a435e0 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 8 Apr 2026 17:07:26 +0900 Subject: Merge RubyGems/Bundler 4.0.6 --- lib/rubygems.rb | 3 +-- test/rubygems/test_gem.rb | 22 ---------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/rubygems.rb b/lib/rubygems.rb index a99aec3f97..c0aacfc31b 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -192,9 +192,8 @@ module Gem begin spec.activate rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax - name = spec.name spec = Gem::Specification.find_unloaded_by_path(path) - spec ||= Gem::Specification.find_by_name(name) + spec ||= Gem::Specification.find_by_name(spec.name) if spec.nil? raise e else diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 4293bc5ba8..74c8953904 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -1213,28 +1213,6 @@ class TestGem < Gem::TestCase assert Gem.try_activate("b"), "try_activate should still return true" end - def test_try_activate_does_not_raise_no_method_error_on_activation_conflict - a1 = util_spec "a", "1.0" do |s| - s.files << "lib/a/old.rb" - end - - a2 = util_spec "a", "2.0" do |s| - s.files << "lib/a/old.rb" - s.files << "lib/a/new_file.rb" - end - - install_specs a1, a2 - - # Activate the older version - gem "a", "= 1.0" - - # try_activate a file only in the newer version should not raise - # NoMethodError on nil (https://bugs.ruby-lang.org/issues/21954) - assert_nothing_raised do - Gem.try_activate("a/new_file") - end - end - def test_spec_order_is_consistent b1 = util_spec "b", "1.0" b2 = util_spec "b", "2.0" -- cgit v1.2.3