Skip to content

Commit

Permalink
Harden the ObjectSpace.memsize_of spec
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
byroot authored and headius committed Oct 31, 2024
1 parent 26fb7b6 commit 82a1f5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/objectspace/memsize_of_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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
Expand Down

0 comments on commit 82a1f5f

Please sign in to comment.