Skip to content

Commit 1171574

Browse files
committed
Backport assert_allocations
1 parent 88bbc66 commit 1171574

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/sandbox/test/rendering_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def test_render_inline_allocations
1717

1818
allocations =
1919
if Rails.version.to_f < 8.0
20-
{"3.3.10" => 126, "3.2.9" => 128..129, "3.1.7" => 130, "3.0.7" => 131}
20+
{"3.3" => 126, "3.2" => 128..129, "3.1" => 130, "3.0" => 131}
2121
elsif Rails.version.split(".").first(2).map(&:to_i) == [8, 0]
22-
{"3.5.0" => 118, "3.4.7" => 122, "3.3.10" => 134}
22+
{"3.5" => 118, "3.4" => 122, "3.3" => 134}
2323
else
24-
{"3.5.0" => 116, "3.4.7" => 120}
24+
{"3.5" => 116, "3.4" => 120}
2525
end
2626

2727
assert_allocations(**allocations) do

test/test_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def capture_warnings(&block)
192192
def assert_allocations(count_map, &block)
193193
trace = AllocationStats.trace(&block)
194194
total = trace.allocations.all.size
195-
count = count_map[RUBY_VERSION]
195+
count = count_map[RUBY_VERSION.split(".").first(2).join(".")]
196196

197-
assert_equal count, total, "Expected #{count} allocations, got #{total} allocations for Ruby #{RUBY_VERSION}"
197+
assert count === total, "Expected #{count} allocations, got #{total} allocations for Ruby #{RUBY_VERSION}"
198198
end

0 commit comments

Comments
 (0)