test per-post permalinks
Add tests for setting a permalink on a post (in YAML frontmatter), both the "old way" (generating an index.html) and with an .html ex- tension.
This commit is contained in:
parent
40e44a2051
commit
c0dfe3165c
|
@ -63,3 +63,23 @@ Feature: Fancy permalinks
|
|||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
|
||||
|
||||
Scenario: Use per-post permalink
|
||||
Given I have a _posts directory
|
||||
And I have the following post:
|
||||
| title | date | permalink | content |
|
||||
| Some post | 4/14/2013 | /custom/posts/1 | bla bla |
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And the _site/custom/posts/1 directory should exist
|
||||
And I should see "bla bla" in "_site/custom/posts/1/index.html"
|
||||
|
||||
Scenario: Use per-post ending in .html
|
||||
Given I have a _posts directory
|
||||
And I have the following post:
|
||||
| title | date | permalink | content |
|
||||
| Some post | 4/14/2013 | /custom/posts/some.html | bla bla |
|
||||
When I run jekyll
|
||||
Then the _site directory should exist
|
||||
And the _site/custom/posts directory should exist
|
||||
And I should see "bla bla" in "_site/custom/posts/some.html"
|
||||
|
|
|
@ -66,7 +66,7 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire
|
|||
end
|
||||
|
||||
matter_hash = {}
|
||||
%w(title layout tag tags category categories published author path).each do |key|
|
||||
%w(title layout tag tags category categories published author path permalink).each do |key|
|
||||
matter_hash[key] = post[key] if post[key]
|
||||
end
|
||||
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
|
||||
|
|
Loading…
Reference in New Issue