diff --git a/test/source/_posts/2009-01-27-empty-categories.textile b/test/source/_posts/2009-01-27-empty-categories.textile new file mode 100644 index 00000000..6e784cc1 --- /dev/null +++ b/test/source/_posts/2009-01-27-empty-categories.textile @@ -0,0 +1,7 @@ +--- +layout: default +title: Category in YAML +categories: +--- + +Best *post* ever diff --git a/test/source/_posts/2009-01-27-empty-category.textile b/test/source/_posts/2009-01-27-empty-category.textile new file mode 100644 index 00000000..7e8b1b35 --- /dev/null +++ b/test/source/_posts/2009-01-27-empty-category.textile @@ -0,0 +1,7 @@ +--- +layout: default +title: Category in YAML +category: +--- + +Best *post* ever diff --git a/test/source/_posts/2009-05-18-empty-tag.textile b/test/source/_posts/2009-05-18-empty-tag.textile new file mode 100644 index 00000000..1f103f64 --- /dev/null +++ b/test/source/_posts/2009-05-18-empty-tag.textile @@ -0,0 +1,6 @@ +--- +title: A Tag +tag: +--- + +Whoa. diff --git a/test/source/_posts/2009-05-18-empty-tags.textile b/test/source/_posts/2009-05-18-empty-tags.textile new file mode 100644 index 00000000..5339d15d --- /dev/null +++ b/test/source/_posts/2009-05-18-empty-tags.textile @@ -0,0 +1,6 @@ +--- +title: Some Tags +tags: +--- + +Awesome! diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 357dd4db..47f25d6d 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 18, @site.posts.size + assert_equal 22, @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 b4b4502d..6c8aeba5 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -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