Skip to content

Commit 0fcd943

Browse files
committed
test compatibility with Herb
1 parent d5da7ab commit 0fcd943

File tree

6 files changed

+32
-0
lines changed

6 files changed

+32
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ group :development, :test do
3030
gem "puma", ">= 6"
3131
gem "rake", "~> 13"
3232
gem "rails-dom-testing", "~> 2.3.0"
33+
gem "reactionview"
3334
gem "redis"
3435
gem "rspec-rails"
3536
gem "rubocop-md", "~> 2"

Gemfile.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ GEM
145145
temple (>= 0.8.2)
146146
thor
147147
tilt
148+
herb (0.8.2-aarch64-linux-gnu)
149+
herb (0.8.2-aarch64-linux-musl)
150+
herb (0.8.2-arm-linux-gnu)
151+
herb (0.8.2-arm-linux-musl)
152+
herb (0.8.2-arm64-darwin)
153+
herb (0.8.2-x86_64-darwin)
154+
herb (0.8.2-x86_64-linux-gnu)
155+
herb (0.8.2-x86_64-linux-musl)
148156
i18n (1.14.7)
149157
concurrent-ruby (~> 1.0)
150158
io-console (0.8.1)
@@ -265,6 +273,9 @@ GEM
265273
erb
266274
psych (>= 4.0.0)
267275
tsort
276+
reactionview (0.1.6)
277+
actionview (>= 7.0)
278+
herb (>= 0.7.5, < 1.0.0)
268279
redis (5.4.1)
269280
redis-client (>= 0.22.0)
270281
redis-client (0.25.1)
@@ -427,6 +438,7 @@ DEPENDENCIES
427438
rails (~> 8)
428439
rails-dom-testing (~> 2.3.0)
429440
rake (~> 13)
441+
reactionview
430442
redis
431443
rspec-rails
432444
rubocop-md (~> 2)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div>
2+
<%= content %>
3+
<%= @message %>
4+
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class HerbComponent < ViewComponent::Base
4+
def initialize(message:)
5+
@message = message
6+
end
7+
end

test/sandbox/config/application.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
require "haml"
3535
require "slim"
3636
require "jbuilder"
37+
require "reactionview"
3738

3839
module Sandbox
3940
class Application < Rails::Application

test/sandbox/test/rendering_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@ def test_renders_erb_template
295295
assert_text("bar")
296296
end
297297

298+
def test_renders_herb_template
299+
render_inline(HerbComponent.new(message: "bar")) { "foo" }
300+
301+
assert_text("foo")
302+
assert_text("bar")
303+
end
304+
298305
def test_renders_partial_template
299306
render_inline(PartialComponent.new)
300307

0 commit comments

Comments
 (0)