From a6c4a842db78ce61dc823eaf055eb3373e4b296d Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 23 Oct 2024 14:58:08 +0200 Subject: [PATCH] Harden the ObjectSpace.memsize_of spec [Bug #20803] `abc` is used a lot across the ruby spec suite, if another test runs before this spec is loaded and create this symbol dynamically (`"abc".to_sym`) the spec will fail. So it's preferable to use a symbol name that is very unlikely to be used elsewhere to avoid flakes. --- spec/ruby/library/objectspace/memsize_of_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ruby/library/objectspace/memsize_of_spec.rb b/spec/ruby/library/objectspace/memsize_of_spec.rb index eefafbb334..cbb5a07d54 100644 --- a/spec/ruby/library/objectspace/memsize_of_spec.rb +++ b/spec/ruby/library/objectspace/memsize_of_spec.rb @@ -13,7 +13,7 @@ describe "ObjectSpace.memsize_of" do end it "returns 0 for literal Symbols" do - ObjectSpace.memsize_of(:abc).should == 0 + ObjectSpace.memsize_of(:object_space_memsize_spec_static_sym).should == 0 end it "returns a positive Integer for an Object" do