From 0113fea7a1603363bc4099d5c5db1f11dfa6f7f2 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 14:26:20 +0200 Subject: [PATCH] Add tests for using custom excerpt --- .../_posts/2013-04-11-custom-excerpt.markdown | 8 ++++++++ test/test_generated_site.rb | 2 +- test/test_post.rb | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/source/_posts/2013-04-11-custom-excerpt.markdown diff --git a/test/source/_posts/2013-04-11-custom-excerpt.markdown b/test/source/_posts/2013-04-11-custom-excerpt.markdown new file mode 100644 index 00000000..7212704e --- /dev/null +++ b/test/source/_posts/2013-04-11-custom-excerpt.markdown @@ -0,0 +1,8 @@ +--- +layout: ~ +excerpt: 'I can set a custom excerpt with *markdown*' +--- + +This is not my excerpt. + +Neither is this. diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index abda0ba5..56413466 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase end should "ensure post count is as expected" do - assert_equal 31, @site.posts.size + assert_equal 32, @site.posts.size end should "insert site.posts into the index" do diff --git a/test/test_post.rb b/test/test_post.rb index b5b082a3..dfba0758 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -320,6 +320,21 @@ class TestPost < Test::Unit::TestCase assert !@post.excerpt.include?("---"), "does not contains separator" 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("

I can set a custom excerpt with markdown

", @post.excerpt) + end + + end + end end