test/test_rbst.rb in RbST-0.2.0 vs test/test_rbst.rb in RbST-0.3.0
- old
+ new
@@ -1,5 +1,7 @@
+# encoding: UTF-8
+
require 'helper'
require 'mocha'
class TestRbST < Test::Unit::TestCase
def setup
@@ -56,25 +58,30 @@
end
end
should "recognize strip_comments option" do
html_with_comment = RbST.convert(".. comment")
- assert_equal html_with_comment, %Q{<div class="document">\n<!-- comment -->\n</div>}
+ assert_equal html_with_comment, %Q{<div class=\"document\">\n<!-- comment -->\n</div>\n}
html_without_comment = RbST.convert(".. comment", 'strip-comments')
- assert_equal html_without_comment, %Q{<div class="document">\n</div>}
+ assert_equal html_without_comment, %Q{<div class=\"document\">\n</div>\n}
end
should "recognize cloak_email_addresses option" do
html_with_uncloaked_email = RbST.convert("steve@mac.com")
- assert_equal %Q{<div class="document">\n<p><a class="reference external" href="mailto:steve@mac.com">steve@mac.com</a></p>\n</div>}, html_with_uncloaked_email
+ assert_equal %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve@mac.com\">steve@mac.com</a></p>\n</div>\n}, html_with_uncloaked_email
html_with_cloaked_email = RbST.convert("steve@mac.com", 'cloak-email-addresses')
- assert_equal %Q{<div class="document">\n<p><a class="reference external" href="mailto:steve%40mac.com">steve<span>@</span>mac<span>.</span>com</a></p>\n</div>}, html_with_cloaked_email
+ assert_equal %Q{<div class=\"document\">\n<p><a class=\"reference external\" href=\"mailto:steve%40mac.com\">steve<span>@</span>mac<span>.</span>com</a></p>\n</div>\n}, html_with_cloaked_email
end
should "recognize part option" do
html_body = RbST.convert("hello world", :part => :html_body)
- assert_equal %Q{<div class="document">\n<p>hello world</p>\n</div>}, html_body
+ assert_equal %Q{<div class=\"document\">\n<p>hello world</p>\n</div>\n}, html_body
fragment = RbST.convert("hello world", :part => :fragment)
- assert_equal %Q{<p>hello world</p>}, fragment
+ assert_equal %Q{<p>hello world</p>\n}, fragment
+ end
+
+ should "convert unicode" do
+ output = RbST.convert("Hello ☃", :part => :fragment)
+ assert_equal %Q{<p>Hello ☃</p>\n}, output
end
end