all repos — markup @ 19cf832689f02ff290ac94c4d685dcf0b3816e12

The code we use to render README.your_favorite_markup

test/markup_test.rb (view raw)

 1$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
 2
 3require 'github/markup'
 4require 'test/unit'
 5
 6class MarkupTest < Test::Unit::TestCase
 7  Dir['test/markups/README.*'].each do |readme|
 8    next if readme =~ /html$/
 9    markup = readme.split('.').last
10
11    define_method "test_#{markup}" do
12      expected = File.read("#{readme}.html")
13      actual = GitHub::Markup.render(readme, File.read(readme))
14
15      assert expected == actual, <<-message
16#{markup} expected:
17#{expected}
18#{markup} actual:
19#{actual}
20message
21    end
22  end
23
24  def test_knows_what_it_can_and_cannot_render
25    assert_equal false, GitHub::Markup.can_render?('README.html')
26    assert_equal true, GitHub::Markup.can_render?('README.markdown')
27    assert_equal false, GitHub::Markup.can_render?('README.cmd')
28  end
29end