Removing the extremely brittle generated_site test and moving the tags check into post.rb so pages don't break

This commit is contained in:
Nick Quaranto 2009-05-18 17:52:05 -04:00
parent 102f6be6a2
commit 99098dd8c7
3 changed files with 8 additions and 46 deletions

View File

@ -22,14 +22,6 @@ module Jekyll
self.content = self.content[($1.size + 5)..-1] self.content = self.content[($1.size + 5)..-1]
self.data = YAML.load($1) self.data = YAML.load($1)
if self.data.has_key?("tag")
self.tags = [self.data["tag"]]
elsif self.data.has_key?("tags")
self.tags = self.data['tags']
else
self.tags = []
end
end end
end end

View File

@ -47,6 +47,14 @@ module Jekyll
self.published = true self.published = true
end end
if self.data.has_key?("tag")
self.tags = [self.data["tag"]]
elsif self.data.has_key?("tags")
self.tags = self.data['tags']
else
self.tags = []
end
if self.categories.empty? if self.categories.empty?
if self.data.has_key?('category') if self.data.has_key?('category')
self.categories << self.data['category'] self.categories << self.data['category']

View File

@ -1,38 +0,0 @@
require File.dirname(__FILE__) + '/helper'
class TestGeneratedSite < Test::Unit::TestCase
context "generated sites" do
setup do
clear_dest
stub(Jekyll).configuration do
Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
end
@site = Site.new(Jekyll.configuration)
@site.process
@index = File.read(dest_dir('index.html'))
end
should "insert site.posts into the index" do
assert @index.include?("#{@site.posts.size} Posts")
end
should "render post.content" do
latest_post = Dir[source_dir('_posts', '*')].sort.last
post = Post.new(@site, source_dir, '', File.basename(latest_post))
post.transform
assert @index.include?(post.content)
end
should "hide unpublished posts" do
published = Dir[dest_dir('publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
assert_equal 1, published.size
assert_equal "published.html", published.first
end
should "not copy _posts directory" do
assert !File.exist?(dest_dir('_posts'))
end
end
end