Sha256: fe37582a3d07bd976368052d802b39ad2d6db9e719e88f6cc20d9317e3d64b3f

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

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
    latest_post = Dir[File.join(@source, '_posts/*')].sort.last
    post = Post.new(@source, '', File.basename(latest_post))
    Jekyll.content_type = post.determine_content_type
    post.transform
    assert @index.include?(post.content)
  end

  def test_unpublished_posts_are_hidden
    published = Dir[File.join(dest_dir, 'publish_test/2008/02/02/*/index.html')].map {|f| File.basename(f)}
    
    assert_equal 1, published.size
    assert_equal "index.html", published.first
  end

  def test_post_categories_in_category_test
    category_test = File.read(File.join(dest_dir, 'category_test.html'))
    assert category_test.include?('<div>foo bar baz</div>')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jsjohnst-jekyll-0.4.1.999.1 test/test_generated_site.rb
jsjohnst-jekyll-0.4.1.999.2 test/test_generated_site.rb
jsjohnst-jekyll-0.4.1.999.3 test/test_generated_site.rb
jsjohnst-jekyll-0.4.1.999.4 test/test_generated_site.rb
jsjohnst-jekyll-0.4.1.999.6 test/test_generated_site.rb