Permalink
Browse files

Merge pull request #1 from cgroner/master

(cgroner) Missing test cases for defaults.
  • Loading branch information...
2 parents a78f86f + 69e7f4a commit bb9f1064d31c5ba850d051ec105152350fa3252a @laumann laumann committed Nov 4, 2011
Showing with 29 additions and 1 deletion.
  1. +5 −1 lib/jekyll/converters/textile.rb
  2. +24 −0 test/test_redcloth.rb
@@ -28,7 +28,11 @@ def output_ext(ext)
def convert(content)
setup
r = RedCloth.new(content)
- r.hard_breaks = @config['redcloth']['hard_breaks']
+
+ if !@config['redcloth'].nil? and !@config['redcloth']['hard_breaks'].nil?
+ r.hard_breaks = @config['redcloth']['hard_breaks']
+ end
+
r.to_html
end
end
View
@@ -1,6 +1,30 @@
require File.dirname(__FILE__) + '/helper'
class TestRedCloth < Test::Unit::TestCase
+
+ context "RedCloth default (no explicit config) hard_breaks enabled" do
+ setup do
+ @textile = TextileConverter.new
+ end
+
+ should "preserve single line breaks in HTML output" do
+ assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
+ end
+ end
+
+ context "Default hard_breaks enabled w/ redcloth section, no hard_breaks value" do
+ setup do
+ config = {
+ 'redcloth' => {}
+ }
+ @textile = TextileConverter.new config
+ end
+
+ should "preserve single line breaks in HTML output" do
+ assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
+ end
+ end
+
context "RedCloth with hard_breaks enabled" do
setup do
config = {

0 comments on commit bb9f106

Please sign in to comment.