[rubygems/rubygems] Fix duplicated specs when they have been previously activated

https://github.com/rubygems/rubygems/commit/b44bf2ac74
This commit is contained in:
David Rodríguez 2024-10-10 20:50:48 +02:00 committed by git
parent 1001ea9606
commit 57404e4369
2 changed files with 15 additions and 1 deletions

View File

@ -30,7 +30,7 @@ module Gem
# Returns the list of all specifications in the record
def all
@all ||= Gem.loaded_specs.values + stubs.map(&:to_spec)
@all ||= stubs.map(&:to_spec)
end
##

View File

@ -1026,6 +1026,20 @@ class TestGem < Gem::TestCase
Gem.refresh
end
def test_activated_specs_does_not_cause_duplicates_when_looping_through_specs
util_make_gems
s = Gem::Specification.first
s.activate
Gem.refresh
assert_equal 1, Gem::Specification.count {|spec| spec.full_name == s.full_name }
Gem.loaded_specs.delete(s)
Gem.refresh
end
def test_self_ruby_escaping_spaces_in_path
with_clean_path_to_ruby do
with_rb_config_ruby("C:/Ruby 1.8/bin/ruby.exe") do