diff options
author | David RodrÃguez <[email protected]> | 2024-10-10 20:50:48 +0200 |
---|---|---|
committer | git <[email protected]> | 2024-10-14 14:51:20 +0000 |
commit | 57404e4369df11f77f089d5d11d310679b2e749f (patch) | |
tree | e13fd561a5ccd99c73e8feec83e1610b19ba2f27 | |
parent | 1001ea9606fd9bbbce70deaab0e6a31c5af1a20c (diff) |
[rubygems/rubygems] Fix duplicated specs when they have been previously activated
https://github.com/rubygems/rubygems/commit/b44bf2ac74
-rw-r--r-- | lib/rubygems/specification_record.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/rubygems/specification_record.rb b/lib/rubygems/specification_record.rb index d838fcea26..195a355496 100644 --- a/lib/rubygems/specification_record.rb +++ b/lib/rubygems/specification_record.rb @@ -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 ## diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 0d048b08b7..cdc3479e37 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -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 |