Add tests for using custom excerpt

This commit is contained in:
maul.esel 2013-04-11 14:26:20 +02:00
parent 069e70d1b3
commit 0113fea7a1
3 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,8 @@
---
layout: ~
excerpt: 'I can set a custom excerpt with *markdown*'
---
This is not my excerpt.
Neither is this.

View File

@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end end
should "ensure post count is as expected" do should "ensure post count is as expected" do
assert_equal 31, @site.posts.size assert_equal 32, @site.posts.size
end end
should "insert site.posts into the index" do should "insert site.posts into the index" do

View File

@ -320,6 +320,21 @@ class TestPost < Test::Unit::TestCase
assert !@post.excerpt.include?("---"), "does not contains separator" assert !@post.excerpt.include?("---"), "does not contains separator"
end end
end end
context "with custom excerpt" do
setup do
file = "2013-04-11-custom-excerpt.markdown"
@post.process(file)
@post.read_yaml(@source, file)
@post.transform
end
should "use custom excerpt" do
assert_equal("<p>I can set a custom excerpt with <em>markdown</em></p>", @post.excerpt)
end
end
end end
end end