Sha256: 91917a3ff6f2f94eb1014b8e900f2393ad96d73b34b354b2d4bee9d0f7413287

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TestSite < Test::Unit::TestCase
  def setup
    @source = File.join(File.dirname(__FILE__), *%w[source])
    @s = Site.new(@source, dest_dir)
  end
  
  def test_site_init
    
  end
  
  def test_read_layouts
    @s.read_layouts
    
    assert_equal ["default", "simple"].sort, @s.layouts.keys.sort
  end
 
  def test_read_posts
    @s.read_posts('')
    posts = Dir[File.join(@source, '_posts/*')]
    assert_equal posts.size - 1, @s.posts.size
  end
  
  def test_site_payload
    clear_dest
    @s.process
    
    posts = Dir[File.join(@source, "**", "_posts/*")]
    categories = %w(bar baz category foo z_category publish_test).sort

    assert_equal posts.size - 1, @s.posts.size
    assert_equal categories, @s.categories.keys.sort
    assert_equal 4, @s.categories['foo'].size
  end

  def test_filter_entries
    ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
              .baz.markdow foo.markdown~]
    ent2 = %w[.htaccess _posts bla.bla]

    assert_equal %w[foo.markdown bar.markdown baz.markdown], @s.filter_entries(ent1)
    assert_equal ent2, @s.filter_entries(ent2)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
calavera-jekyll-0.4.1 test/test_site.rb
sixones-jekyll-0.4.1 test/test_site.rb