test/test_post.rb in jekyll-1.0.0.beta4 vs test/test_post.rb in jekyll-1.0.0.rc1

- old
+ new

@@ -11,11 +11,11 @@ end context "A Post" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) end should "ensure valid posts are valid" do assert Post.valid?("2008-09-09-foo-bar.textile") @@ -93,11 +93,11 @@ @real_file = "2010-01-08-triple-dash.markdown" end should "consume the embedded dashes" do @post.read_yaml(@source, @real_file) - assert_equal({"title" => "Foo --- Bar", "layout" => "post"}, @post.data) + assert_equal({"title" => "Foo --- Bar"}, @post.data) assert_equal "Triple the fun!", @post.content end end context "with site wide permalink" do @@ -137,22 +137,10 @@ should "process the url correctly" do assert_equal "/:categories/:year/:month/:day/:title.html", @post.template assert_equal "/2013/2008/09/09/foo-bar.html", @post.url end end - - context "with unspecified layout" do - setup do - file = '2013-01-12-no-layout.textile' - @post = setup_post(file) - @post.process(file) - end - - should "default to 'post' layout" do - assert_equal "post", @post.data["layout"] - end - end context "with specified layout of nil" do setup do file = '2013-01-12-nil-layout.textile' @post = setup_post(file) @@ -318,17 +306,35 @@ should "replace separator with new-lines" do 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 = setup_post(file) + do_render(@post) + end + + should "use custom excerpt" do + assert_equal("I can set a custom excerpt", @post.excerpt) + end + + should "expose custom excerpt to liquid" do + assert @post.content.include?("I can use the excerpt: <quote>I can set a custom excerpt</quote>"), "Exposes incorrect excerpt to liquid." + end + + end + end end context "when in a site" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) @site.posts = [setup_post('2008-02-02-published.textile'), setup_post('2009-01-27-categories.textile')] end @@ -517,10 +523,10 @@ end end context "converter file extension settings" do setup do - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) end should "process .md as markdown under default configuration" do post = setup_post '2011-04-12-md-extension.md'