Merge pull request #2575 from alfredxing/test-document-permalink
This commit is contained in:
commit
36c5017300
|
@ -127,7 +127,7 @@ module Jekyll
|
|||
#
|
||||
# Returns the computed URL for the document.
|
||||
def url
|
||||
@url ||= URL.new({
|
||||
@url = URL.new({
|
||||
template: url_template,
|
||||
placeholders: url_placeholders,
|
||||
permalink: permalink
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Override permalink
|
||||
layout: slide
|
||||
permalink: /slide/3/
|
||||
---
|
|
@ -165,6 +165,28 @@ class TestDocument < Test::Unit::TestCase
|
|||
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
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue