test/test_post.rb in jekyll-1.0.0.beta1 vs test/test_post.rb in jekyll-1.0.0.beta2

- old
+ new

@@ -250,9 +250,55 @@ @post.read_yaml(@source, @real_file) @post.transform assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", @post.content end + + context "#excerpt" do + setup do + file = "2013-01-02-post-excerpt.markdown" + @post.process(file) + @post.read_yaml(@source, file) + @post.transform + end + + should "return first paragraph by default" do + assert @post.excerpt.include?("First paragraph"), "contains first paragraph" + assert !@post.excerpt.include?("Second paragraph"), "does not contains second paragraph" + assert !@post.excerpt.include?("Third paragraph"), "does not contains third paragraph" + end + + should "correctly resolve link references" do + assert @post.excerpt.include?("www.jekyllrb.com"), "contains referenced link URL" + end + + should "return rendered HTML" do + assert_equal "<p>First paragraph with <a href='http://www.jekyllrb.com/'>link ref</a>.</p>", + @post.excerpt + end + + context "with excerpt_separator setting" do + setup do + file = "2013-01-02-post-excerpt.markdown" + + @post.site.config['excerpt_separator'] = "\n---\n" + + @post.process(file) + @post.read_yaml(@source, file) + @post.transform + end + + should "respect given separator" do + assert @post.excerpt.include?("First paragraph"), "contains first paragraph" + assert @post.excerpt.include?("Second paragraph"), "contains second paragraph" + assert !@post.excerpt.include?("Third paragraph"), "does not contains third paragraph" + end + + should "replace separator with new-lines" do + assert !@post.excerpt.include?("---"), "does not contains separator" + end + end + end end context "when in a site" do setup do clear_dest