Skip to content

Commit 79e5f15

Browse files
committed
interpolate template engine into heredoc
1 parent 5b20812 commit 79e5f15

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/generators/view_component/component/templates/component.rb.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<% module_namespacing do -%>
44
class <%= class_name %><%= options[:skip_suffix] ? "" : "Component" %> < <%= parent_class %>
55
<%- if inline_template? -%>
6-
<%= template_engine %>_template <<~ERB
6+
<%= template_engine %>_template <<~<%= template_engine.upcase %>
77
<h1>Hello, World!</h1>
8-
ERB
8+
<%= template_engine.upcase %>
99
<%- end -%>
1010
<%- if initialize_signature? -%>
1111
def initialize(<%= initialize_signature %>)

test/sandbox/test/generators/component_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_invoking_slim_template_engine_inline
142142
run_generator %w[user --inline --template-engine slim]
143143

144144
assert_file "app/components/user_component.rb" do |component|
145-
assert_match(/slim_template/, component)
145+
assert_match(/slim_template <<~SLIM/, component)
146146
end
147147

148148
assert_no_file "app/components/user_component.html.slim"

0 commit comments

Comments
 (0)