Skip to content

Commit

Permalink
Test that two calls to stub_for returns the same (cached) instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
voxik authored and deivid-rodriguez committed Mar 19, 2020
1 parent 4d0e181 commit 00b3f55
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/rubygems/test_gem_specification.rb
Expand Up @@ -1193,6 +1193,11 @@ def test_self_stubs_for_lazy_loading
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)
Expand Down

0 comments on commit 00b3f55

Please sign in to comment.