Merge pull request #1078 from maul-esel/fix-num-category
Fix number category
This commit is contained in:
commit
f9502dc9f5
|
@ -76,7 +76,7 @@ module Jekyll
|
|||
|
||||
def populate_categories
|
||||
if self.categories.empty?
|
||||
self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase}
|
||||
self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase}
|
||||
end
|
||||
self.categories.flatten!
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
layout: default
|
||||
title: Number Category in YAML
|
||||
category: 2013
|
||||
---
|
||||
|
||||
Please make me pass
|
|
@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "ensure post count is as expected" do
|
||||
assert_equal 33, @site.posts.size
|
||||
assert_equal 34, @site.posts.size
|
||||
end
|
||||
|
||||
should "insert site.posts into the index" do
|
||||
|
|
|
@ -423,6 +423,12 @@ class TestPost < Test::Unit::TestCase
|
|||
assert_equal [], post.categories
|
||||
end
|
||||
|
||||
should "recognize number category in yaml" do
|
||||
post = setup_post("2013-05-10-number-category.textile")
|
||||
assert post.categories.include?('2013')
|
||||
assert !post.categories.include?(2013)
|
||||
end
|
||||
|
||||
should "recognize tag in yaml" do
|
||||
post = setup_post("2009-05-18-tag.textile")
|
||||
assert post.tags.include?('code')
|
||||
|
|
|
@ -172,7 +172,7 @@ class TestSite < Test::Unit::TestCase
|
|||
|
||||
posts = Dir[source_dir("**", "_posts", "**", "*")]
|
||||
posts.delete_if { |post| File.directory?(post) && !Post.valid?(post) }
|
||||
categories = %w(bar baz category foo z_category publish_test win).sort
|
||||
categories = %w(2013 bar baz category foo z_category publish_test win).sort
|
||||
|
||||
assert_equal posts.size - @num_invalid_posts, @site.posts.size
|
||||
assert_equal categories, @site.categories.keys.sort
|
||||
|
|
Loading…
Reference in New Issue