Skip to content

Commit ce74df1

Browse files
committed
fix coberage
1 parent 6ad979f commit ce74df1

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<p class='cache-component__cache-key'><%= view_cache_dependencies %></p>
2+
<%# <% binding.irb %>
3+
4+
<p class='cache-component__cache-message' data-time=data-time="<%= Time.zone.now %>"><%= "#{foo} #{bar}" %></p>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
class NoCacheComponent < ViewComponent::Base
4+
include ViewComponent::Cacheable
5+
6+
attr_reader :foo, :bar
7+
8+
def initialize(foo:, bar:)
9+
@foo = foo
10+
@bar = bar
11+
end
12+
end

test/sandbox/test/rendering_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,4 +1278,12 @@ def test_cache_component
12781278
assert_selector(".cache-component__cache-key", text: new_component.view_cache_dependencies)
12791279
assert_selector(".cache-component__cache-message", text: "foo baz")
12801280
end
1281+
1282+
def test_no_cache_component
1283+
component = NoCacheComponent.new(foo: "foo", bar: "bar")
1284+
render_inline(NoCacheComponent.new(foo: "foo", bar: "bar"))
1285+
1286+
assert_selector(".cache-component__cache-key", text: component.view_cache_dependencies)
1287+
assert_selector(".cache-component__cache-message", text: "foo bar")
1288+
end
12811289
end

0 commit comments

Comments
 (0)