diff --git a/app/components/bulma/subtitle_component.rb b/app/components/bulma/subtitle_component.rb index 37bb6f3..d67aace 100644 --- a/app/components/bulma/subtitle_component.rb +++ b/app/components/bulma/subtitle_component.rb @@ -7,7 +7,7 @@ def initialize(text = nil) end def call - content_tag :p, @text, class: "subtitle" + content_tag :p, @text || content, class: "subtitle" end end end diff --git a/spec/components/bulma/subtitle_component_spec.rb b/spec/components/bulma/subtitle_component_spec.rb index db189a4..bab57ef 100644 --- a/spec/components/bulma/subtitle_component_spec.rb +++ b/spec/components/bulma/subtitle_component_spec.rb @@ -12,4 +12,10 @@ expect(page).to have_content "Subtitle" end + + it "render content provided as a block" do + render_inline(described_class.new) { "Subtitle" } + + expect(page).to have_content "Subtitle" + end end