test/test_format_helpers.rb in padrino-helpers-0.9.1 vs test/test_format_helpers.rb in padrino-helpers-0.9.2
- old
+ new
@@ -59,9 +59,21 @@
actual_text = word_wrap(1.upto(50).to_a.join(" "), 80)
assert_equal 1.upto(30).to_a.join(" ") + "\n" + 31.upto(50).to_a.join(" "), actual_text
end
end
+ context 'for #highlight method' do
+ should 'highligth with defaults' do
+ actual_text = highlight('Lorem ipsum dolor sit amet', 'dolor')
+ assert_equal 'Lorem ipsum <strong class="highlight">dolor</strong> sit amet', actual_text
+ end
+
+ should 'highlight with highlighter' do
+ actual_text = highlight('Lorem ipsum dolor sit amet', 'dolor', :highlighter => '<span class="custom">\1</span>')
+ assert_equal 'Lorem ipsum <span class="custom">dolor</span> sit amet', actual_text
+ end
+ end
+
context 'for #truncate method' do
should "support default truncation" do
actual_text = truncate("Once upon a time in a world far far away")
assert_equal "Once upon a time in a world...", actual_text
end