test/tilt_markdown_test.rb in tilt-1.4.1 vs test/tilt_markdown_test.rb in tilt-2.0.0.beta1
- old
+ new
@@ -1,7 +1,8 @@
# coding: UTF-8
require 'tilt'
+require 'test_helper'
begin
require 'nokogiri'
module MarkdownTests
@@ -36,13 +37,10 @@
html = nrender "Hello <b>World</b>", :escape_html => false
assert_equal "<p>Hello <b>World</b></p>", html
end
def test_escape_html_true
- if self.class.template == Tilt::RedcarpetTemplate
- flunk "redcarpet doesn't support :escape_html yet"
- end
html = nrender "Hello <b>World</b>", :escape_html => true
assert_equal "<p>Hello <b>World</b></p>", html
end
def test_smart_quotes
@@ -75,32 +73,33 @@
assert_equal "<p>Hello “World” — This is —– a test …</p>", html
end
end
begin
- require 'rdiscount'
+ require 'tilt/rdiscount'
- class MarkdownRDiscountTest < Test::Unit::TestCase
+ class MarkdownRDiscountTest < Minitest::Test
include MarkdownTests
template Tilt::RDiscountTemplate
end
rescue LoadError => boom
# It should already be warned in the main tests
end
begin
- require 'redcarpet'
+ require 'tilt/redcarpet'
- class MarkdownRedcarpetTest < Test::Unit::TestCase
+ class MarkdownRedcarpetTest < Minitest::Test
include MarkdownTests
template Tilt::RedcarpetTemplate
# Doesn't support escaping
undef test_escape_html_true
def test_smarty_pants_true
+ # Various versions of Redcarpet support various versions of Smart pants.
html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
- assert_equal "<p>Hello “World'' – This is — a test …</p>", html
+ assert_match /<p>Hello “World(''|”) – This is — a test …<\/p>/, html
end
def test_fenced_code_blocks_with_lang
code = <<-COD.gsub(/^\s+/,"")
```ruby
@@ -115,24 +114,24 @@
rescue LoadError => boom
# It should already be warned in the main tests
end
begin
- require 'bluecloth'
+ require 'tilt/bluecloth'
- class MarkdownBlueClothTest < Test::Unit::TestCase
+ class MarkdownBlueClothTest < Minitest::Test
include MarkdownTests
template Tilt::BlueClothTemplate
end
rescue LoadError => boom
# It should already be warned in the main tests
end
begin
- require 'kramdown'
+ require 'tilt/kramdown'
- class MarkdownKramdownTest < Test::Unit::TestCase
+ class MarkdownKramdownTest < Minitest::Test
include MarkdownTests
template Tilt::KramdownTemplate
# Doesn't support escaping
undef test_escape_html_true
# Smarty Pants is *always* on, but doesn't support it fully
@@ -144,12 +143,12 @@
# It should already be warned in the main tests
end
begin
- require 'maruku'
+ require 'tilt/maruku'
- class MarkdownMarukuTest < Test::Unit::TestCase
+ class MarkdownMarukuTest < Minitest::Test
include MarkdownTests
template Tilt::MarukuTemplate
# Doesn't support escaping
undef test_escape_html_true
# Doesn't support Smarty Pants, and even fails on ``Foobar''