test/test_post.rb in jekyll-0.3.0 vs test/test_post.rb in jekyll-0.4.1
- old
+ new
@@ -41,13 +41,21 @@
def test_dir_respects_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", p.dir
+ assert_equal "my_category/", p.dir
end
+
+ def test_url_respects_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.url
+ end
+
def test_read_yaml
p = Post.allocate
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
assert_equal({"title" => "Foo Bar", "layout" => "default"}, p.data)
@@ -85,9 +93,15 @@
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
Jekyll.source = File.join(File.dirname(__FILE__), *%w[source])
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-12-13-include.markdown")
layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
\ No newline at end of file