Skip to content

Commit

Permalink
Render cell with options test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
AlfonsoUceda committed Nov 13, 2024
1 parent 6660c68 commit 763f0bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixtures/song/with_options.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= @title %>
6 changes: 6 additions & 0 deletions test/render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def with_block
render { "Clean Sheets" + render(:with_html) }
end

def with_options(options)
@title = options[:title]
render
end

private
def title
"Papertiger"
Expand Down Expand Up @@ -91,6 +96,7 @@ class RenderTest < Minitest::Spec
it { assert_equal "default", SongCell.new(nil).receiving_options }
it { assert_equal "fancy", SongCell.new(nil).receiving_options(:fancy) }
it { assert_equal "fancy", SongCell.new(nil).call(:receiving_options, :fancy) }
it { assert_equal "A new song\n", SongCell.new(nil).call(:with_options, title: 'A new song') }

# doesn't escape HTML.
it { assert_equal "<p>Yew!</p>", SongCell.new(nil).call(:with_html) }
Expand Down

0 comments on commit 763f0bd

Please sign in to comment.