added scenario to test correct site generation for a site with layouts, pages, posts and files

This commit is contained in:
Kris Brown 2010-01-05 09:43:17 +00:00
parent 5ea06f3ad9
commit b5916caf4b
2 changed files with 34 additions and 4 deletions

View File

@ -29,7 +29,7 @@ Feature: Create sites
Scenario: Basic site with layout and a post Scenario: Basic site with layout and a post
Given I have a _layouts directory Given I have a _layouts directory
And I have a _posts directory And I have a _posts directory
And I have the following post: And I have the following posts:
| title | date | layout | content | | title | date | layout | content |
| Wargames | 3/27/2009 | default | The only winning move is not to play. | | Wargames | 3/27/2009 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}" And I have a default layout that contains "Post Layout: {{ content }}"
@ -37,6 +37,36 @@ Feature: Create sites
Then the _site directory should exist Then the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html" And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layouts, pages, posts and files
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }}"
And I have a post layout that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a blog directory
And I have a "blog/index.html" page with layout "page" that contains "category index page"
And I have an "about.html" file that contains "No replacement {{ site.posts.size }}"
And I have an "another_file" file that contains ""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 3/27/2009 | post | content for entry1. |
| entry2 | 4/27/2009 | post | content for entry2. |
And I have a category/_posts directory
And I have the following posts in "category":
| title | date | layout | content |
| entry3 | 5/27/2009 | post | content for entry3. |
| entry4 | 6/27/2009 | post | content for entry4. |
When I run jekyll
Then the _site directory should exist
And I should see "Page Layout: 4" in "_site/index.html"
And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
And I should see "" in "_site/another_file"
And I should see "Page Layout: 4" in "_site/blog/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2009/03/27/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2009/04/27/entry2.html"
And I should see "Post Layout: <p>content for entry3.</p>" in "_site/category/2009/05/27/entry3.html"
And I should see "Post Layout: <p>content for entry4.</p>" in "_site/category/2009/06/27/entry4.html"
Scenario: Basic site with include tag Scenario: Basic site with include tag
Given I have a _includes directory Given I have a _includes directory
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"

View File

@ -13,7 +13,7 @@ Given /^I have a blank site in "(.*)"$/ do |path|
end end
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
Given /^I have an "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text| Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
File.open(file, 'w') do |f| File.open(file, 'w') do |f|
f.write <<EOF f.write <<EOF
--- ---
@ -25,7 +25,7 @@ EOF
end end
end end
Given /^I have an "(.*)" file that contains "(.*)"$/ do |file, text| Given /^I have an? "(.*)" file that contains "(.*)"$/ do |file, text|
File.open(file, 'w') do |f| File.open(file, 'w') do |f|
f.write(text) f.write(text)
f.close f.close
@ -40,7 +40,7 @@ Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
end end
Given /^I have a (.*) directory$/ do |dir| Given /^I have a (.*) directory$/ do |dir|
FileUtils.mkdir(dir) FileUtils.mkdir_p(dir)
end end
Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table| Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table|