test/test_post.rb in jekyll-0.5.6 vs test/test_post.rb in jekyll-0.5.7
- old
+ new
@@ -34,10 +34,11 @@
@fake_file = "2008-10-19-foo-bar.textile"
@source = source_dir('_posts')
end
should "keep date, title, and markup type" do
+ @post.categories = []
@post.process(@fake_file)
assert_equal Time.parse("2008-10-19"), @post.date
assert_equal "foo-bar", @post.slug
assert_equal ".textile", @post.ext
@@ -222,10 +223,20 @@
should "not published when published yaml is false" do
post = setup_post("2008-02-02-not-published.textile")
assert_equal false, post.published
end
+ should "recognize date in yaml" do
+ post = setup_post("2010-01-09-date-override.textile")
+ assert_equal "/2010/01/10/date-override.html", post.url
+ end
+
+ should "recognize time in yaml" do
+ post = setup_post("2010-01-09-time-override.textile")
+ assert_equal "/2010/01/10/time-override.html", post.url
+ end
+
should "recognize category in yaml" do
post = setup_post("2009-01-27-category.textile")
assert post.categories.include?('foo')
end
@@ -234,10 +245,20 @@
assert post.categories.include?('foo')
assert post.categories.include?('bar')
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')
end
@@ -246,9 +267,19 @@
assert post.tags.include?('food')
assert post.tags.include?('cooking')
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
end