# coding: UTF-8 require 'test_helper' class SmartyPantsTest < Redcarpet::TestCase def setup @pants = Redcarpet::Render::SmartyPants end def test_that_smart_converts_single_quotes_in_words_that_end_in_re markdown = @pants.render("
They're not for sale.
") assert_equal "They’re not for sale.
", markdown end def test_that_smart_converts_single_quotes_in_words_that_end_in_ll markdown = @pants.render("Well that'll be the day
") assert_equal "Well that’ll be the day
", markdown end def test_that_smart_converts_double_quotes_to_curly_quotes rd = @pants.render(%("Quoted text"
)) assert_equal %(“Quoted text”
), rd end def test_that_smart_gives_ve_suffix_a_rsquo rd = @pants.render("I've been meaning to tell you ..
") assert_equal "I’ve been meaning to tell you ..
", rd end def test_that_smart_gives_m_suffix_a_rsquo rd = @pants.render("I'm not kidding
") assert_equal "I’m not kidding
", rd end def test_that_smart_gives_d_suffix_a_rsquo rd = @pants.render("what'd you say?
") assert_equal "what’d you say?
", rd end def test_that_backticks_are_preserved rd = @pants.render("single `backticks` in HTML should be preserved
") assert_equal "single `backticks` in HTML should be preserved
", rd end def test_that_smart_converts_trailing_single_quotes_to_curly_quotes rd = @pants.render("Hopin' that this bug gets some fixin'.
") assert_equal "Hopin’ that this bug gets some fixin’.
", rd end def test_that_is_not_confused_by_fractions rd = @pants.render('I am 1/4... of the way to 1/4/2000') assert_equal "I am ¼… of the way to 1/4/2000", rd end def test_that_smart_converts_multiple_single_quotes rd = @pants.render(%('First' and 'second' and 'third'
)) assert_equal %(‘First’ and ‘second’ and ‘third’
), rd end end