add cucumber tests for overriding path

This commit is contained in:
maul.esel 2013-04-13 00:06:09 +02:00
parent 968f3b0911
commit c20fc03604
3 changed files with 16 additions and 1 deletions

View File

@ -168,6 +168,15 @@ Feature: Post data
| dir | dir/ | | dir | dir/ |
| dir/nested | dir/nested/ | | dir/nested | dir/nested/ |
Scenario: Override page.path variable
Given I have a _posts directory
And I have the following post:
| title | date | path | content |
| override | 4/12/2013 | override-path.html | Custom path: {{ page.path }} |
When I run jekyll
Then the _site directory should exist
And I should see "Custom path: override-path.html" in "_site/2013/04/12/override.html"
Scenario: Disable a post from being published Scenario: Disable a post from being published
Given I have a _posts directory Given I have a _posts directory
And I have an "index.html" file that contains "Published!" And I have an "index.html" file that contains "Published!"

View File

@ -22,6 +22,12 @@ Feature: Site data
| dir | dir/about.html | | dir | dir/about.html |
| dir/nested | dir/nested/page.html | | dir/nested | dir/nested/page.html |
Scenario: Override page.path
Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}"
When I run jekyll
Then the _site directory should exist
And I should see "Custom path: custom-override.html" in "_site/override.html"
Scenario: Use site.time variable Scenario: Use site.time variable
Given I have an "index.html" page that contains "{{ site.time }}" Given I have an "index.html" page that contains "{{ site.time }}"
When I run jekyll When I run jekyll

View File

@ -66,7 +66,7 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire
end end
matter_hash = {} matter_hash = {}
%w(title layout tag tags category categories published author).each do |key| %w(title layout tag tags category categories published author path).each do |key|
matter_hash[key] = post[key] if post[key] matter_hash[key] = post[key] if post[key]
end end
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp