From 2616a4cf5e3f89988e6c7bf1bc69e010b52cb533 Mon Sep 17 00:00:00 2001 From: ChaYoung You Date: Thu, 10 Jul 2014 17:25:13 +0900 Subject: [PATCH 1/3] Replace duplicated `category` feature with `categories` --- features/post_data.feature | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/post_data.feature b/features/post_data.feature index c72f52fa..109affd5 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -141,16 +141,16 @@ Feature: Post data Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" - Scenario: Use post.categories variable when category is in YAML + Scenario: Use post.categories variable when categories are in YAML Given I have a _posts directory And I have a _layouts directory And I have the following post: - | title | date | layout | category | content | - | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | - And I have a simple layout that contains "Post category: {{ page.categories }}" + | title | date | layout | categories | content | + | Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. | + And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll build Then the _site directory should exist - And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" + And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" Scenario: Use post.categories variable when categories are in YAML with mixed case Given I have a _posts directory From 8006024715bd7d1d62983e38828eaa225ef1a532 Mon Sep 17 00:00:00 2001 From: ChaYoung You Date: Thu, 10 Jul 2014 18:03:02 +0900 Subject: [PATCH 2/3] Add missed tests for categories --- features/post_data.feature | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/features/post_data.feature b/features/post_data.feature index 109affd5..e8e2beeb 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -70,17 +70,29 @@ Feature: Post data Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" + Scenario: Use post.categories variable when category is in a folder and has category in YAML + Given I have a movies directory + And I have a movies/_posts directory + And I have a _layouts directory + And I have the following post in "movies": + | title | date | layout | category | content | + | Star Wars | 2009-03-27 | simple | film | Luke, I am your father. | + And I have a simple layout that contains "Post category: {{ page.categories }}" + When I run jekyll build + Then the _site directory should exist + And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html" + Scenario: Use post.categories variable when category is in a folder and has categories in YAML Given I have a movies directory And I have a movies/_posts directory And I have a _layouts directory And I have the following post in "movies": - | title | date | layout | categories | content | - | Star Wars | 2009-03-27 | simple | [film] | Luke, I am your father. | + | title | date | layout | categories | content | + | Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll build Then the _site directory should exist - And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html" + And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html" Scenario: Use post.tags variable Given I have a _posts directory From 2716f65010b87dc5b0df019fa71f1442ec14c903 Mon Sep 17 00:00:00 2001 From: ChaYoung You Date: Thu, 10 Jul 2014 18:03:50 +0900 Subject: [PATCH 3/3] Add tests for duplicated categories --- features/post_data.feature | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/features/post_data.feature b/features/post_data.feature index e8e2beeb..0ecaeef6 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -94,6 +94,18 @@ Feature: Post data Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html" + Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML + Given I have a movies directory + And I have a movies/_posts directory + And I have a _layouts directory + And I have the following post in "movies": + | title | date | layout | category | content | + | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | + And I have a simple layout that contains "Post category: {{ page.categories }}" + When I run jekyll build + Then the _site directory should exist + And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" + Scenario: Use post.tags variable Given I have a _posts directory And I have a _layouts directory @@ -164,6 +176,17 @@ Feature: Post data Then the _site directory should exist And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" + Scenario: Use post.categories variable when categories are in YAML and are duplicated + Given I have a _posts directory + And I have a _layouts directory + And I have the following post: + | title | date | layout | categories | content | + | Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. | + And I have a simple layout that contains "Post category: {{ page.categories }}" + When I run jekyll build + Then the _site directory should exist + And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" + Scenario: Use post.categories variable when categories are in YAML with mixed case Given I have a _posts directory And I have a _layouts directory