public
Rubygem
Description: BlueCloth's evil twin - convert HTML into Markdown
Homepage: http://www.craigjolicoeur.com/clothblue
Clone URL: git://github.com/cpjolicoeur/clothblue.git
Search Repo:
Click here to lend your support to: clothblue and make a donation at www.pledgie.com !
cpjolicoeur (author)
Wed May 14 09:29:20 -0700 2008
commit  daee589339cca71d6a3473c1f8c96d12801b84d7
tree    b2d0cd028121d1401cefbd4faae52ba406979ca2
parent  b71a64b7ef2cd9fbe8b901564b4951cc2b797d98
clothblue / test / test_formatting.rb
100644 33 lines (26 sloc) 0.761 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# test_formatting.rb
# May 15, 2008
#
 
#circumventing a require Problem:
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
 
begin
  require "rubygems"
  require "clothblue"
rescue LoadError
  require "clothblue"
end
 
require "test/unit"
 
class TestClothBlueFormatting < Test::Unit::TestCase
  
  FORMATTING_STRINGS = [
    ["<b>bold</b>","**bold**"], ["<strong>strong</strong>", "**strong**"],
    ["<em>emphasized</em>", "_emphasized_"],["<i>italics</i>", "_italics_"],
    ["<code>ClothBlue#to_markdown</code>", "`ClothBlue#to_markdown`"]
  ]
 
  def test_textformatting
    FORMATTING_STRINGS.each do |html, markdown|
      test_html = ClothBlue.new(html)
      result = test_html.to_markdown
      assert_equal(markdown,result)
    end
  end
 
end