added tests for handling of tags and catergories, see #73 and #84

This commit is contained in:
Kris Brown 2010-01-10 16:12:41 +00:00
parent e0e4a47af1
commit 2292e4268c
6 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,7 @@
---
layout: default
title: Category in YAML
categories:
---
Best *post* ever

View File

@ -0,0 +1,7 @@
---
layout: default
title: Category in YAML
category:
---
Best *post* ever

View File

@ -0,0 +1,6 @@
---
title: A Tag
tag:
---
Whoa.

View File

@ -0,0 +1,6 @@
---
title: Some Tags
tags:
---
Awesome!

View File

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

View File

@ -236,6 +236,16 @@ class TestPost < Test::Unit::TestCase
assert post.categories.include?('baz')
end
should "recognize empty category in yaml" do
post = setup_post("2009-01-27-empty-category.textile")
assert_equal [], post.categories
end
should "recognize empty categories in yaml" do
post = setup_post("2009-01-27-empty-categories.textile")
assert_equal [], post.categories
end
should "recognize tag in yaml" do
post = setup_post("2009-05-18-tag.textile")
assert post.tags.include?('code')
@ -248,6 +258,16 @@ class TestPost < Test::Unit::TestCase
assert post.tags.include?('pizza')
end
should "recognize empty tag in yaml" do
post = setup_post("2009-05-18-empty-tag.textile")
assert_equal [], post.tags
end
should "recognize empty tags in yaml" do
post = setup_post("2009-05-18-empty-tags.textile")
assert_equal [], post.tags
end
should "allow no yaml" do
post = setup_post("2009-06-22-no-yaml.textile")
assert_equal "No YAML.", post.content