Merge branch 'qrush/shoulda' into can_has_good_tests
Conflicts: test/test_generated_site.rb test/test_post.rb test/test_site.rb test/test_tags.rb
This commit is contained in:
commit
18b512a531
|
@ -2,6 +2,7 @@ require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'redgreen'
|
require 'redgreen'
|
||||||
|
require 'shoulda'
|
||||||
|
|
||||||
include Jekyll
|
include Jekyll
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestFilters < Test::Unit::TestCase
|
class TestFilters < Test::Unit::TestCase
|
||||||
|
|
||||||
class JekyllFilter
|
class JekyllFilter
|
||||||
include Jekyll::Filters
|
include Jekyll::Filters
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
|
||||||
@filter = JekyllFilter.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_textilize_with_simple_string
|
context "filters" do
|
||||||
assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
|
setup do
|
||||||
end
|
@filter = JekyllFilter.new
|
||||||
|
end
|
||||||
|
|
||||||
def test_array_to_sentence_string_with_no_args
|
should "textilize with simple string" do
|
||||||
assert_equal "", @filter.array_to_sentence_string([])
|
assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_array_to_sentence_string_with_one_arg
|
should "convert array to sentence string with no args" do
|
||||||
assert_equal "1", @filter.array_to_sentence_string([1])
|
assert_equal "", @filter.array_to_sentence_string([])
|
||||||
assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
|
end
|
||||||
|
|
||||||
|
should "convert array to sentence string with one arg" do
|
||||||
|
assert_equal "1", @filter.array_to_sentence_string([1])
|
||||||
|
assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "convert array to sentence string with two args" do
|
||||||
|
assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
|
||||||
|
assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "convert array to sentence string with multiple args" do
|
||||||
|
assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
|
||||||
|
assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "escape xml with ampersands" do
|
||||||
|
assert_equal "AT&T", @filter.xml_escape("AT&T")
|
||||||
|
assert_equal "<code>command &lt;filename&gt;</code>", @filter.xml_escape("<code>command <filename></code>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_array_to_sentence_string_with_two_args
|
|
||||||
assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
|
|
||||||
assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_array_to_sentence_string_with_multiple_args
|
|
||||||
assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
|
|
||||||
assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_xml_escape_with_ampersands
|
|
||||||
assert_equal "AT&T", @filter.xml_escape("AT&T")
|
|
||||||
assert_equal "<code>command &lt;filename&gt;</code>", @filter.xml_escape("<code>command <filename></code>")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,38 +1,36 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestGeneratedSite < Test::Unit::TestCase
|
class TestGeneratedSite < Test::Unit::TestCase
|
||||||
def setup
|
context "generated sites" do
|
||||||
clear_dest
|
setup do
|
||||||
@config = Jekyll::DEFAULTS.clone
|
clear_dest
|
||||||
@config['source'] = File.join(File.dirname(__FILE__), *%w[source])
|
@source = File.join(File.dirname(__FILE__), *%w[source])
|
||||||
@config['destination'] = dest_dir
|
@s = Site.new(@source, dest_dir)
|
||||||
Jekyll.configure(@config)
|
@s.process
|
||||||
@s = Site.new(@config)
|
@index = File.read(File.join(dest_dir, 'index.html'))
|
||||||
@s.process
|
end
|
||||||
@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
|
should "insert site.posts into the index" do
|
||||||
# confirm that the {{ post.content }} is rendered OK
|
assert @index.include?("#{@s.posts.size} Posts")
|
||||||
latest_post = Dir[File.join(@config['source'], '_posts/*')].last
|
end
|
||||||
post = Post.new(@config['source'], '', File.basename(latest_post))
|
|
||||||
post.transform
|
|
||||||
assert @index.include?(post.content)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_unpublished_posts_are_hidden
|
should "render post.content" do
|
||||||
published = Dir[File.join(dest_dir, 'publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
|
latest_post = Dir[File.join(@source, '_posts/*')].last
|
||||||
|
post = Post.new(@source, '', File.basename(latest_post))
|
||||||
assert_equal 1, published.size
|
Jekyll.content_type = post.determine_content_type
|
||||||
assert_equal "published.html", published.first
|
post.transform
|
||||||
end
|
assert @index.include?(post.content)
|
||||||
|
end
|
||||||
|
|
||||||
def test_posts_directory_not_copied
|
should "hide unpublished posts" do
|
||||||
assert !File.exist?(File.join(dest_dir, '_posts'))
|
published = Dir[File.join(dest_dir, 'publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
|
||||||
|
|
||||||
|
assert_equal 1, published.size
|
||||||
|
assert_equal "published.html", published.first
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not copy _posts directory" do
|
||||||
|
assert !File.exist?(File.join(dest_dir, '_posts'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,144 +1,135 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestPost < Test::Unit::TestCase
|
class TestPost < Test::Unit::TestCase
|
||||||
def setup
|
should "ensure valid posts are valid" do
|
||||||
Jekyll.configure(Jekyll::DEFAULTS)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_valid
|
|
||||||
assert Post.valid?("2008-10-19-foo-bar.textile")
|
assert Post.valid?("2008-10-19-foo-bar.textile")
|
||||||
assert Post.valid?("foo/bar/2008-10-19-foo-bar.textile")
|
assert Post.valid?("foo/bar/2008-10-19-foo-bar.textile")
|
||||||
|
|
||||||
assert !Post.valid?("lol2008-10-19-foo-bar.textile")
|
assert !Post.valid?("lol2008-10-19-foo-bar.textile")
|
||||||
assert !Post.valid?("blah")
|
assert !Post.valid?("blah")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_process
|
|
||||||
p = Post.allocate
|
|
||||||
p.process("2008-10-19-foo-bar.textile")
|
|
||||||
|
|
||||||
assert_equal Time.parse("2008-10-19"), p.date
|
|
||||||
assert_equal "foo-bar", p.slug
|
|
||||||
assert_equal ".textile", p.ext
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_url
|
|
||||||
p = Post.allocate
|
|
||||||
p.categories = []
|
|
||||||
p.process("2008-10-19-foo-bar.textile")
|
|
||||||
|
|
||||||
assert_equal "/2008/10/19/foo-bar.html", p.url
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_permalink
|
|
||||||
p = Post.allocate
|
|
||||||
p.process("2008-12-03-permalinked-post.textile")
|
|
||||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
|
|
||||||
|
|
||||||
assert_equal "my_category/permalinked-post", p.permalink
|
context "processing posts" do
|
||||||
end
|
setup do
|
||||||
|
@post = Post.allocate
|
||||||
|
@real_file = "2008-10-18-foo-bar.textile"
|
||||||
|
@fake_file = "2008-10-19-foo-bar.textile"
|
||||||
|
@source = File.join(File.dirname(__FILE__), *%w[source _posts])
|
||||||
|
end
|
||||||
|
|
||||||
def test_dir_respects_permalink
|
should "keep date, title, and markup type" do
|
||||||
p = Post.allocate
|
@post.process(@fake_file)
|
||||||
p.process("2008-12-03-permalinked-post.textile")
|
|
||||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
|
|
||||||
|
|
||||||
assert_equal "my_category/", p.dir
|
assert_equal Time.parse("2008-10-19"), @post.date
|
||||||
end
|
assert_equal "foo-bar", @post.slug
|
||||||
|
assert_equal ".textile", @post.ext
|
||||||
def test_url_respects_permalink
|
end
|
||||||
p = Post.allocate
|
|
||||||
p.process("2008-12-03-permalinked-post.textile")
|
|
||||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
|
|
||||||
|
|
||||||
assert_equal "my_category/permalinked-post", p.url
|
should "create url based on date and title" do
|
||||||
end
|
@post.categories = []
|
||||||
|
@post.process(@fake_file)
|
||||||
|
assert_equal "/2008/10/19/foo-bar.html", @post.url
|
||||||
|
end
|
||||||
|
|
||||||
def test_read_yaml
|
should "respect permalink" do
|
||||||
p = Post.allocate
|
file = "2008-12-03-permalinked-post.textile"
|
||||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
|
@post.process(file)
|
||||||
|
@post.read_yaml(@source, file)
|
||||||
assert_equal({"title" => "Foo Bar", "layout" => "default"}, p.data)
|
|
||||||
assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", p.content
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_transform
|
|
||||||
p = Post.allocate
|
|
||||||
p.process("2008-10-18-foo-bar.textile")
|
|
||||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
|
|
||||||
p.transform
|
|
||||||
|
|
||||||
assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", p.content
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_published
|
assert_equal "my_category/permalinked-post", @post.permalink
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-02-02-published.textile")
|
assert_equal "my_category/", @post.dir
|
||||||
assert_equal true, p.published
|
assert_equal "my_category/permalinked-post", @post.url
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_not_published
|
should "read yaml front-matter" do
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-02-02-not-published.textile")
|
@post.read_yaml(@source, @real_file)
|
||||||
assert_equal false, p.published
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_yaml_category
|
assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data)
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-category.textile")
|
assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", @post.content
|
||||||
assert p.categories.include?('foo')
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_yaml_categories
|
should "transform textile" do
|
||||||
p1 = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',
|
@post.process(@real_file)
|
||||||
"2009-01-27-categories.textile")
|
@post.read_yaml(@source, @real_file)
|
||||||
p2 = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',
|
@post.transform
|
||||||
"2009-01-27-array-categories.textile")
|
|
||||||
|
assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", @post.content
|
||||||
[p1, p2].each do |p|
|
|
||||||
assert p.categories.include?('foo')
|
|
||||||
assert p.categories.include?('bar')
|
|
||||||
assert p.categories.include?('baz')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_render
|
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
|
|
||||||
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
|
|
||||||
p.render(layouts, {"site" => {"posts" => []}})
|
|
||||||
|
|
||||||
assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", p.output
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_write
|
|
||||||
clear_dest
|
|
||||||
|
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
|
|
||||||
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
|
|
||||||
p.render(layouts, {"site" => {"posts" => []}})
|
|
||||||
p.write(dest_dir)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_data
|
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-11-21-complex.textile")
|
|
||||||
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
|
|
||||||
p.render(layouts, {"site" => {"posts" => []}})
|
|
||||||
|
|
||||||
assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", p.output
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_categories_and_topics
|
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
|
||||||
assert_equal ['foo'], p.categories
|
|
||||||
assert_equal ['bar'], p.topics
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_include
|
|
||||||
config = Jekyll::DEFAULTS.clone
|
|
||||||
config['source'] = File.join(File.dirname(__FILE__), *%w[source])
|
|
||||||
Jekyll.configure(config)
|
|
||||||
|
|
||||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-12-13-include.markdown")
|
context "initializing posts" do
|
||||||
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
|
setup do
|
||||||
p.render(layouts, {"site" => {"posts" => []}})
|
@setup_post = lambda do |file|
|
||||||
|
Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', file)
|
||||||
assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", p.output
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "publish when published yaml is no specified" do
|
||||||
|
post = @setup_post.call("2008-02-02-published.textile")
|
||||||
|
assert_equal true, post.published
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not published when published yaml is false" do
|
||||||
|
post = @setup_post.call("2008-02-02-not-published.textile")
|
||||||
|
assert_equal false, post.published
|
||||||
|
end
|
||||||
|
|
||||||
|
should "recognize category in yaml" do
|
||||||
|
post = @setup_post.call("2009-01-27-category.textile")
|
||||||
|
assert post.categories.include?('foo')
|
||||||
|
end
|
||||||
|
|
||||||
|
should "recognize several categories in yaml" do
|
||||||
|
post = @setup_post.call("2009-01-27-categories.textile")
|
||||||
|
assert post.categories.include?('foo')
|
||||||
|
assert post.categories.include?('bar')
|
||||||
|
assert post.categories.include?('baz')
|
||||||
|
end
|
||||||
|
|
||||||
|
context "rendering" do
|
||||||
|
setup do
|
||||||
|
clear_dest
|
||||||
|
@render = lambda do |post|
|
||||||
|
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
|
||||||
|
post.render(layouts, {"site" => {"posts" => []}})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "render properly" do
|
||||||
|
post = @setup_post.call("2008-10-18-foo-bar.textile")
|
||||||
|
@render.call(post)
|
||||||
|
assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", post.output
|
||||||
|
end
|
||||||
|
|
||||||
|
should "write properly" do
|
||||||
|
post = @setup_post.call("2008-10-18-foo-bar.textile")
|
||||||
|
@render.call(post)
|
||||||
|
post.write(dest_dir)
|
||||||
|
|
||||||
|
assert File.directory?(dest_dir)
|
||||||
|
assert File.exists?(File.join(dest_dir, '2008', '10', '18', 'foo-bar.html'))
|
||||||
|
end
|
||||||
|
|
||||||
|
should "insert data" do
|
||||||
|
post = @setup_post.call("2008-11-21-complex.textile")
|
||||||
|
@render.call(post)
|
||||||
|
|
||||||
|
assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", post.output
|
||||||
|
end
|
||||||
|
|
||||||
|
should "include templates" do
|
||||||
|
Jekyll.source = File.join(File.dirname(__FILE__), 'source')
|
||||||
|
post = @setup_post.call("2008-12-13-include.markdown")
|
||||||
|
@render.call(post)
|
||||||
|
|
||||||
|
assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", post.output
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "generate categories and topics" do
|
||||||
|
post = Post.new(File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
||||||
|
assert_equal ['foo'], post.categories
|
||||||
|
assert_equal ['bar'], post.topics
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,48 +1,42 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestSite < Test::Unit::TestCase
|
class TestSite < Test::Unit::TestCase
|
||||||
def setup
|
context "creating sites" do
|
||||||
@config = Jekyll::DEFAULTS.clone
|
setup do
|
||||||
@config['source'] = File.join(File.dirname(__FILE__), *%w[source])
|
@source = File.join(File.dirname(__FILE__), 'source')
|
||||||
@config['destination'] = dest_dir
|
@s = Site.new(@source, dest_dir)
|
||||||
Jekyll.configure(@config)
|
end
|
||||||
@s = Site.new(@config)
|
|
||||||
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(@config['source'], '_posts/*')]
|
|
||||||
assert_equal posts.size - 1, @s.posts.size
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_site_payload
|
|
||||||
clear_dest
|
|
||||||
@s.process
|
|
||||||
|
|
||||||
posts = Dir[File.join(@config['source'], "**", "_posts/*")]
|
|
||||||
categories = %w(bar baz category foo z_category publish_test).sort
|
|
||||||
|
|
||||||
assert_equal posts.size - 1, @s.posts.size
|
should "read layouts" do
|
||||||
assert_equal categories, @s.categories.keys.sort
|
@s.read_layouts
|
||||||
assert_equal 4, @s.categories['foo'].size
|
assert_equal ["default", "simple"].sort, @s.layouts.keys.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_filter_entries
|
should "read posts" do
|
||||||
ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
|
@s.read_posts('')
|
||||||
.baz.markdow foo.markdown~]
|
posts = Dir[File.join(@source, '_posts/*')]
|
||||||
ent2 = %w[.htaccess _posts bla.bla]
|
assert_equal posts.size - 1, @s.posts.size
|
||||||
|
end
|
||||||
|
|
||||||
assert_equal %w[foo.markdown bar.markdown baz.markdown], @s.filter_entries(ent1)
|
should "deploy payload" do
|
||||||
assert_equal ent2, @s.filter_entries(ent2)
|
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 3, @s.categories['foo'].size
|
||||||
|
end
|
||||||
|
|
||||||
|
should "filter entries" do
|
||||||
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestTags < Test::Unit::TestCase
|
class TestTags < Test::Unit::TestCase
|
||||||
|
context "tagging" do
|
||||||
def setup
|
setup do
|
||||||
@content = <<CONTENT
|
@content = <<CONTENT
|
||||||
---
|
---
|
||||||
layout: post
|
layout: post
|
||||||
title: This is a test
|
title: This is a test
|
||||||
|
@ -17,15 +17,15 @@ puts "bye"
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
CONTENT
|
CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_markdown_with_pygments_line_handling
|
should "render markdown with pygments line handling" do
|
||||||
Jekyll.pygments = true
|
Jekyll.pygments = true
|
||||||
context = {"content_type" => 'markdown'}
|
Jekyll.content_type = :markdown
|
||||||
|
|
||||||
result = Liquid::Template.parse(@content).render(context, [Jekyll::Filters])
|
result = Liquid::Template.parse(@content).render({}, [Jekyll::Filters])
|
||||||
result = Jekyll.markdown(result)
|
result = Jekyll.markdown_proc.call(result)
|
||||||
assert_no_match(/markdown\-html\-error/,result)
|
assert_no_match(/markdown\-html\-error/,result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue