Skip to content

Commit 5e0c01b

Browse files
committed
fix tests
1 parent 4ed3f44 commit 5e0c01b

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

test/sandbox/test/rendering_test.rb

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,9 @@ def test_render_inline_allocations
1515
ViewComponent::CompileCache.cache.delete(MyComponent)
1616
MyComponent.ensure_compiled
1717

18-
allocations =
19-
if Rails.version.to_f < 8.0
20-
{"3.3.8" => 128, "3.3.0" => 140, "3.2.8" => 126, "3.1.7" => 126, "3.0.7" => 135}
21-
elsif Rails.version.split(".").first(2).map(&:to_i) == [8, 0]
22-
{"3.5.0" => 121, "3.4.3" => 125, "3.3.8" => 137}
23-
else
24-
{"3.4.3" => 123}
25-
end
18+
allocations = (Rails.version.to_f >= 8.0) ?
19+
{"3.5.0" => 123, "3.4.2" => 125, "3.3.7" => 138} :
20+
{"3.3.7" => 128, "3.3.0" => 140, "3.2.8" => 126, "3.1.7" => 126, "3.0.7" => 135}
2621

2722
assert_allocations(**allocations) do
2823
render_inline(MyComponent.new)
@@ -1278,30 +1273,4 @@ def test_cache_component
12781273
assert_selector(".cache-component__cache-key", text: new_component.view_cache_dependencies)
12791274
assert_selector(".cache-component__cache-message", text: "foo baz")
12801275
end
1281-
1282-
def test_inherited_cache_component
1283-
component = InheritedCacheComponent.new(foo: "foo", bar: "bar")
1284-
render_inline(component)
1285-
1286-
assert_selector(".cache-component__cache-key", text: component.view_cache_dependencies)
1287-
assert_selector(".cache-component__cache-message", text: "foo bar")
1288-
1289-
render_inline(InheritedCacheComponent.new(foo: "foo", bar: "bar"))
1290-
1291-
assert_selector(".cache-component__cache-key", text: component.view_cache_dependencies)
1292-
1293-
new_component = InheritedCacheComponent.new(foo: "foo", bar: "baz")
1294-
render_inline(new_component)
1295-
1296-
assert_selector(".cache-component__cache-key", text: new_component.view_cache_dependencies)
1297-
assert_selector(".cache-component__cache-message", text: "foo baz")
1298-
end
1299-
1300-
def test_no_cache_component
1301-
component = NoCacheComponent.new(foo: "foo", bar: "bar")
1302-
render_inline(NoCacheComponent.new(foo: "foo", bar: "bar"))
1303-
1304-
assert_selector(".cache-component__cache-key", text: component.view_cache_dependencies)
1305-
assert_selector(".cache-component__cache-message", text: "foo bar")
1306-
end
13071276
end

0 commit comments

Comments
 (0)