Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Directories with valid post names should be filtered out #875

Merged
merged 2 commits into from Apr 7, 2013
Jump to file or symbol
Failed to load files and symbols.
+4 −1
Split
View
@@ -405,6 +405,7 @@ def get_entries(dir, subfolder)
base = File.join(self.source, dir, subfolder)
return [] unless File.exists?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
+ entries.delete_if { |e| File.directory?(File.join(base, e)) }
end
# Aggregate post information
View
@@ -161,6 +161,7 @@ def generate(site)
should "read posts" do
@site.read_posts('')
posts = Dir[source_dir('_posts', '*')]
+ posts.delete_if { |post| File.directory?(post) }
assert_equal posts.size - 1, @site.posts.size
end
@@ -169,9 +170,10 @@ def generate(site)
@site.process
posts = Dir[source_dir("**", "_posts", "*")]
+ posts.delete_if { |post| File.directory?(post) }
categories = %w(bar baz category foo z_category publish_test win).sort
- assert_equal posts.size - 1, @site.posts.size
+ assert_equal posts.size, @site.posts.size
@parkr

parkr Mar 20, 2013

Owner

@tombell Do you know why it was posts.size - 1 in the previous version? Couldn't figure it out.

@tombell

tombell Mar 20, 2013

Contributor

I don't look at previous tests unless I wrote them or something broke.

@parkr

parkr Mar 20, 2013

Owner

Neither do I! :-) This one broke, which is weird. The previous test uses posts.size - 1 and passes. Weiiiiiird

assert_equal categories, @site.categories.keys.sort
assert_equal 4, @site.categories['foo'].size
end