Sha256: b9fb0dfae1f50e5f150af0d379799880ff8182a7de794c7c46017caef9f66ea3

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 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", "archive_yearly", "archive_monthly", "archive_daily", "category_index"].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

4 entries across 4 versions & 1 rubygems

Version Path
matflores-jekyll-0.4.1.1 test/test_site.rb
matflores-jekyll-0.4.1 test/test_site.rb
matflores-jekyll-0.4.2 test/test_site.rb
matflores-jekyll-0.4.3 test/test_site.rb