Merge pull request #2575 from alfredxing/test-document-permalink

This commit is contained in:
Parker Moore 2014-07-09 23:43:01 -07:00
commit 36c5017300
3 changed files with 28 additions and 1 deletions

View File

@ -127,7 +127,7 @@ module Jekyll
# #
# Returns the computed URL for the document. # Returns the computed URL for the document.
def url def url
@url ||= URL.new({ @url = URL.new({
template: url_template, template: url_template,
placeholders: url_placeholders, placeholders: url_placeholders,
permalink: permalink permalink: permalink

View File

@ -0,0 +1,5 @@
---
title: Override permalink
layout: slide
permalink: /slide/3/
---

View File

@ -165,6 +165,28 @@ class TestDocument < Test::Unit::TestCase
end end
end end
context "a document in a collection with a custom permalink" do
setup do
@site = Site.new(Jekyll.configuration({
"collections" => ["slides"],
"source" => source_dir,
"destination" => dest_dir
}))
@site.process
@document = @site.collections["slides"].docs[2]
@dest_file = dest_dir("slide/3/index.html")
end
should "know its permalink" do
assert_equal "/slide/3/", @document.permalink
end
should "produce the right URL" do
assert_equal "/slide/3/", @document.url
end
end
context " a document part of a rendered collection" do context " a document part of a rendered collection" do
end end