diff --git a/features/site_data.feature b/features/site_data.feature index 773e1b09eb1..a5927675774 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -4,23 +4,20 @@ Feature: Site data In order to make the site slightly dynamic Scenario: Use page variable in a page - Given I have a blank site - And I have an "contact.html" file with title "Contact" that contains "{{ page.title }}: email@me.com" + Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com" When I run jekyll Then the _site directory should exist - And I should see "Contact: email@me.com" in "_site/index.html" + And I should see "Contact: email@me.com" in "_site/contact.html" Scenario: Use site.time variable - Given I have a blank site - And I have an "index.html" file that contains "Generated on: {{ site.time }}" + Given I have an "index.html" page 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 today's time in "_site/index.html" 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 }}" + Given I have a _posts directory + And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}" And I have the following posts: | title | date | content | | First Post | 3/25/2009 | My First Post | @@ -31,9 +28,8 @@ Feature: Site data And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html" 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 %}" + Given I have a _posts directory + And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}" And I have the following posts: | title | date | content | | First Post | 3/25/2009 | My First Post | @@ -41,12 +37,11 @@ Feature: Site data | Third Post | 3/27/2009 | My Third Post | When I run jekyll Then the _site directory should exist - And I should see "Third Post Second Post First Post" in "_site/index.html" + 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 %}" + Given I have a _posts directory + And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}" And I have the following posts: | title | date | category | content | | Awesome Hack | 3/26/2009 | code | puts 'Hello World' | diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 3129360cddc..bb8dbbea323 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -13,11 +13,11 @@ end # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it -Given /^I have an "(.*)" page(?: with layout "(.*)")? that contains "(.*)"$/ do |file, layout, text| +Given /^I have an "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text| File.open(file, 'w') do |f| f.write <