added tests to confirm that {{ site.posts }} in index.html was empty and {{ post.content }} wasn't rendering (both are now fixed)
This commit is contained in:
parent
0f848ee2d7
commit
b45fd65a36
|
@ -5,8 +5,18 @@ title: Tom Preston-Werner
|
|||
|
||||
h1. Welcome to my site
|
||||
|
||||
h2. Please read our {{ site.posts | size }} Posts
|
||||
|
||||
<ul>
|
||||
{% for post in site.posts %}
|
||||
<li>{{ post.date }} <a href="{{ post.url }}">{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
{% assign first_post = site.posts.first %}
|
||||
<div id="first_post">
|
||||
<h1>{{ first_post.title }}</h1>
|
||||
<div>
|
||||
{{ first_post.content }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
require File.dirname(__FILE__) + '/helper'
|
||||
|
||||
class TestGeneratedSite < Test::Unit::TestCase
|
||||
def setup
|
||||
clear_dest
|
||||
source = File.join(File.dirname(__FILE__), *%w[source])
|
||||
@s = Site.new(source, dest_dir)
|
||||
@s.process
|
||||
@index = File.read(File.join(dest_dir, 'index.html'))
|
||||
end
|
||||
|
||||
def test_site_posts_in_index
|
||||
# confirm that {{ site.posts }} is working
|
||||
assert @index.include?("#{@s.posts.size} Posts")
|
||||
end
|
||||
|
||||
def test_post_content_in_index
|
||||
# confirm that the {{ post.content }} is rendered OK
|
||||
assert @index.include?('<p>This <em>is</em> cool</p>')
|
||||
end
|
||||
end
|
|
@ -27,4 +27,4 @@ class TestSite < Test::Unit::TestCase
|
|||
|
||||
@s.process
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue