diff --git a/test/source/index.html b/test/source/index.html index b3cc7556..493fce7c 100644 --- a/test/source/index.html +++ b/test/source/index.html @@ -5,8 +5,18 @@ title: Tom Preston-Werner h1. Welcome to my site +h2. Please read our {{ site.posts | size }} Posts + \ No newline at end of file + + +{% assign first_post = site.posts.first %} +
+

{{ first_post.title }}

+
+ {{ first_post.content }} +
+
diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb new file mode 100644 index 00000000..56e5e422 --- /dev/null +++ b/test/test_generated_site.rb @@ -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?('

This is cool

') + end +end diff --git a/test/test_site.rb b/test/test_site.rb index ccfd4117..bde6a008 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -27,4 +27,4 @@ class TestSite < Test::Unit::TestCase @s.process end -end \ No newline at end of file +end