Permalink
Browse files

Added a a test to my previous commit.

  • Loading branch information...
DAddYE committed Mar 5, 2012
1 parent 452c8f8 commit 16f395bba17ebf4394152b6a0ffb214cca9b2b9e
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/tilt/markdown.rb
  2. +7 −0 test/tilt_redcarpettemplate_test.rb
View
@@ -86,7 +86,7 @@ def self.engine_initialized?
def generate_renderer
renderer = options.delete(:renderer) || Redcarpet::Render::HTML
return renderer unless options.delete(:smartypants)
- return renderer if renderer == Redcarpet::Render::SmartyPants
+ return renderer if renderer.respond_to?(:<=) && renderer <= Redcarpet::Render::SmartyPants
if renderer == Redcarpet::Render::XHTML
Redcarpet::Render::SmartyHTML.new(:xhtml => true)
@@ -58,6 +58,13 @@ class RedcarpetTemplateTest < Test::Unit::TestCase
assert_match /<p>OKAY &ndash; &#39;Smarty Pants&#39;<\/p>/,
template.render
end
+
+ test "smartypants with a rendererer instance" do
+ template = Tilt::RedcarpetTemplate.new(:renderer => Redcarpet::Render::HTML.new(:hard_wrap => true), :smartypants => true) { |t|
+ "OKAY -- 'Smarty Pants'" }
+ assert_match /<p>OKAY &ndash; &#39;Smarty Pants&#39;<\/p>/,
+ template.render
+ end
end
rescue LoadError => boom
warn "Tilt::RedcarpetTemplate (disabled)"

0 comments on commit 16f395b

Please sign in to comment.