Sha256: 69f54b9a3839358e4dd71d259dcf8fa7511c067e1627c77c34bc5e56481eac3b
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
require File.expand_path('../../unit_test_helper', __FILE__) class RedcarpetTest < Minitest::Test def test_transform_strong result = auto_html("This is **my** text.") { redcarpet } assert_equal '<p>This is <strong>my</strong> text.</p>'+"\n", result end def test_transform_title result = auto_html("## This is a title ##") { redcarpet } assert_equal '<h2>This is a title</h2>'+"\n", result end def test_transform_link result = auto_html('[This is a link](http://example.org/)') { redcarpet } assert_equal '<p><a href="http://example.org/">This is a link</a></p>'+"\n", result end class LinksInNewWindow < ::Redcarpet::Render::HTML def link(link, title, content) "<a href=\"#{link}\" target=\"_blank\">#{content}</a>" end end def test_transform_link_target_blank result = auto_html('[This is a link](http://example.org/)') { redcarpet(:renderer => LinksInNewWindow) } assert_equal '<p><a href="http://example.org/" target="_blank">This is a link</a></p>'+"\n", result end def test_options result = auto_html('http://example.org/') { redcarpet } assert_equal '<p>http://example.org/</p>'+"\n", result result = auto_html('http://example.org/') { redcarpet(:markdown_options => { :autolink => true }) } assert_equal '<p><a href="http://example.org/">http://example.org/</a></p>'+"\n", result end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
auto_html-whistlerbrk-2.0.0.pre | test/unit/filters/redcarpet_test.rb |