From 3ebe81bf068a814db03fb9c3cdbf439b63595672 Mon Sep 17 00:00:00 2001 From: Nick Quaranto Date: Thu, 26 Mar 2009 18:09:08 -0400 Subject: [PATCH] Need to cut down on repeating story steps a bit --- features/create_sites.feature | 19 ++++++--------- features/embed_filters.feature | 26 +++++++++----------- features/post_data.feature | 21 +++++++++++++++- features/site_configuration.feature | 7 ++---- features/site_data.feature | 38 ++++++++++++++++++++++------- 5 files changed, 70 insertions(+), 41 deletions(-) diff --git a/features/create_sites.feature b/features/create_sites.feature index f9cedf4f..6287b2b3 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -16,30 +16,27 @@ Feature: Create sites And I have a post titled "Hackers" for "3/24/2009" that contains "My First Exploit" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And I should see "My First Exploit" in "_site/posts/2009/03/24/hackers.html" + And I should see "My First Exploit" in "_site/2009/03/24/hackers.html" - Scenario: Basic site with layout + Scenario: Basic site with layout and a page Given I have a blank site And I have a _layouts directory And I have an "index.html" file with a "default" layout that contains "Basic Site with Layout" - And I have a default layout that contains "{{ content }}" + And I have a default layout that contains "Page Layout: {{ content }}" When I run jekyll Then the _site directory should exist - And I should see "Basic Site with Layout" in "_site/index.html" + And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" Scenario: Basic site with layout and a post Given I have a blank site And I have a _layouts directory And I have a _posts directory - And I have a post titled "Hackers" for "3/24/2009" that contains "My First Exploit" - And I have an "index.html" file with a "default" layout that contains "Basic Site with Layout and a Post: {{ first_post }}" - And I have a default layout that contains "{{ content }}" + And I have a post titled "Wargames" for "3/26/2009" that contains "Would you like to play a game?" + And I have a post titled "Wargames" for "3/26/2009" with layout "default" + And I have a default layout that contains "Post Layout: {{ content }}" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And I should see "My First Exploit" in "_site/posts/2009/03/24/hackers.html" - And I should see "Basic Site with Layout and a Post: My First Exploit" in "_site/index.html" + And I should see "Post Layout: Would you like to play a game?" in "_site/2009/03/26/wargames.html" Scenario: Basic site with include tag Given I have a blank site diff --git a/features/embed_filters.feature b/features/embed_filters.feature index 85e6a45a..99f629b0 100644 --- a/features/embed_filters.feature +++ b/features/embed_filters.feature @@ -5,47 +5,43 @@ Feature: Embed filters Scenario: Convert date to XML schema Given I have a blank site + And I have a _posts directory And I have a post titled "Date to XML schema" for "3/26/2009" that contains "{{ post.date | date_to_xmlschema }}" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/2009/03/26/date-to-xml-schema.html file should exist - And I should see "2009-03-26T00:00:00-08:00" in "_site/posts/2009/03/26/date-to-xml-schema.html" + And the _site/2009/03/26/date-to-xml-schema.html file should exist + And I should see "2009-03-26T00:00:00-08:00" in "_site/2009/03/26/date-to-xml-schema.html" Scenario: Escape text for XML Given I have a blank site + And I have a _posts directory And I have a post titled "Escape text for XML" for "3/26/2009" that contains "{{ 'Mario & Luigi' | xml_escape }}" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/2009/03/26/escape-text-for-xml.html file should exist - And I should see "<tt>Mario & Luigi<tt>" in "_site/posts/2009/03/26/escape-text-for-xml.html" + And I should see "<tt>Mario & Luigi<tt>" in "_site/2009/03/26/escape-text-for-xml.html" Scenario: Calculate number of words Given I have a blank site + And I have a _posts directory And I have a post titled "Calculate number of words" for "3/26/2009" that contains "{{ post.title | number_of_words }}" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/2009/03/26/calculate-number-of-words.html file should exist - And I should see "4" in "_site/posts/2009/03/26/calculate-number-of-words.html" + And I should see "4" in "_site/2009/03/26/calculate-number-of-words.html" Scenario: Convert an array into a sentence Given I have a blank site + And I have a _posts directory And I have a post titled "Convert array to sentence" for "3/26/2009" with that contains "{{ post.tags | array_to_sentence_string }}" And I have a post titled "Convert array to sentence" for "3/26/2009" with tags "life hacks code" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/2009/03/26/convert-array-to-sentence.html file should exist - And I should see "life, hacks, and code" in "_site/posts/2009/03/26/convert-array-to-sentence.html" + And I should see "life, hacks, and code" in "_site/2009/03/26/convert-array-to-sentence.html" Scenario: Textilize a given string Given I have a blank site + And I have a _posts directory And I have a post titled "Textilize" for "3/26/2009" with that contains "{{ post.author | textilize }}" And I have a post titled "Textilize" for "3/26/2009" with author "*Mr. Spock*" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/2009/03/26/textilize.html file should exist - And I should see "Mr. Spock" in "_site/posts/2009/03/26/textilize.html" + And I should see "Mr. Spock" in "_site/2009/03/26/textilize.html" diff --git a/features/post_data.feature b/features/post_data.feature index 8a8de7a0..8407cc32 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -4,13 +4,32 @@ Feature: Post data In order to make the posts slightly dynamic Scenario: Use post.title variable + Given I have a blank site + And I have a _posts directory + And I have a _layouts directory + And I have a post for "3/26/2009" with title "Star Wars" and with layout "simple" and with content "C3P0!!" + And I have a simple layout that contains "Post title: {{ post.title }}" + When I run jekyll + Then the _site directory should exist + And I should see "Post title: Star Wars" in "_site/2009/03/26/star-wars.html" + Scenario: Use post.url variable + Given I have a blank site + And I have a _posts directory + And I have a _layouts directory + And I have a post for "3/26/2009" with title "Star Wars" and with layout "simple" and with content "C3P0!!" + And I have a simple layout that contains "Post url: {{ post.url }}" + When I run jekyll + Then the _site directory should exist + And I should see "Post url: /2009/03/26/star-wars.html" in "_site/2009/03/26/star-wars.html" + Scenario: Use post.date variable Scenario: Use post.id variable + Scenario: Use post.content variable + Scenario: Use post.categories variable when category is in a folder Scenario: Use post.categories variable when categories are in folders Scenario: Use post.categories variable when categories are in YAML Scenario: Use post.categories variable when category is in YAML Scenario: Use post.topics variable - Scenario: Use post.content variable Scenario: Disable a post from being published Scenario: Use a custom variable diff --git a/features/site_configuration.feature b/features/site_configuration.feature index df3185ef..db41d766 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -68,8 +68,7 @@ Feature: Site configuration And I have a configuration file with "permalink" set to "none" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And I should see "Whoa." in "_site/posts/none-permalink-schema.html" + And I should see "Whoa." in "_site/none-permalink-schema.html" Scenario: Use pretty permalink schema Given I have a blank site @@ -78,9 +77,7 @@ Feature: Site configuration And I have a configuration file with "permalink" set to "pretty" When I run jekyll Then the _site directory should exist - And the _site/posts directory should exist - And the _site/posts/pretty-permalink-schema directory should exist - And I should see "Whoa." in "_site/posts/pretty-permalink-schema/index.html" + And I should see "Whoa." in "_site/2009/03/25/pretty-permalink-schema/index.html" Scenario: Highlight code with pygments Given I have a blank site diff --git a/features/site_data.feature b/features/site_data.feature index 4f52e9ad..a768912f 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -15,18 +15,38 @@ Feature: Site data And I have an "index.html" file that contains "Generated on: {{ site.time }}" When I run jekyll Then the _site directory should exist - And I should see "Generated on: #{Date.today.strftime("%Y-%m-%d")}" in "_site/index.html" + And I should see "Generated on: #{Date.today.strftime('%Y-%m-%d')}" in "_site/index.html" - Scenario: Use site.posts variable for first post + Scenario: Use site.posts variable for latest post Given I have a blank site + And I have a _posts directory And I have an "index.html" file that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}" - And I have a post titled "First Post" for "3/25/2009" that contains "Whoa." - And I have a post titled "Pretty Permalink Schema" for "3/25/2009" that contains "Whoa." - And I have a post titled "Pretty Permalink Schema" for "3/25/2009" that contains "Whoa." + And I have a post titled "First Post" for "3/25/2009" that contains "First!" + And I have a post titled "Second Post" for "3/26/2009" that contains "Second!" + And I have a post titled "Third Post" for "3/27/2009" that contains "Third!" When I run jekyll Then the _site directory should exist - And I should see "Generated on: #{Date.today.strftime("%Y-%m-%d")}" in "_site/index.html" + And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html" - Scenario: Use site.categories variable - Scenario: Use site.categories.life variable - Scenario: Use site.related_posts variable + Scenario: Use site.posts variable in a loop + Given I have a blank site + And I have a _posts directory + And I have an "index.html" file that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}" + And I have a post titled "First Post" for "3/25/2009" that contains "First!" + And I have a post titled "Second Post" for "3/26/2009" that contains "Second!" + And I have a post titled "Third Post" for "3/27/2009" that contains "Third!" + When I run jekyll + Then the _site directory should exist + And I should see "Third Post Second Post First Post" in "_site/index.html" + + Scenario: Use site.categories.code variable + Given I have a blank site + And I have a _posts directory + And I have an "index.html" file that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}" + And I have a post titled "Awesome Hack" for "3/26/2009" that contains "while(true) { puts 'infinity' }" + And I have a post titled "Awesome Hack" for "3/26/2009" with category "code" + And I have a post titled "Delicious Beer" for "3/26/2009" that contains "# Yuengling" + And I have a post titled "Delicious Beer" for "3/26/2009" with category "food" + When I run jekyll + Then the _site directory should exist + And I should see "Awesome Hack" in "_site/index.html"