From 46462200afef55fd21b72ad1ff745739b085a793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 27 Aug 2019 13:16:27 +0200 Subject: [PATCH] [rubygems/rubygems] Test that two calls to `stub_for` returns the same (cached) instance. https://github.com/rubygems/rubygems/commit/00b3f55562 --- test/rubygems/test_gem_specification.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index f6caba896a..afcdc0dab3 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -1193,6 +1193,11 @@ dependencies: [] assert_equal ['b-1'], Gem::Specification.stubs_for('b').map { |s| s.full_name } assert_equal 2, Gem::Specification.class_variable_get(:@@stubs_by_name).length + assert_equal( + Gem::Specification.stubs_for('a').map { |s| s.object_id }, + Gem::Specification.stubs_for('a').map { |s| s.object_id } + ) + Gem.loaded_specs.delete 'a' Gem.loaded_specs.delete 'b' Gem::Specification.class_variable_set(:@@stubs, nil)