Starting on implementing the step defs

This commit is contained in:
Nick Quaranto 2009-03-31 17:26:04 -04:00
parent 6c41f93493
commit c22cd84153
3 changed files with 37 additions and 18 deletions

View File

@ -4,15 +4,13 @@ Feature: Create sites
In order to share my awesome ideas with the interwebs
Scenario: Basic site
Given I have a blank site
And I have an "index.html" file that contains "Basic Site"
Given I have an "index.html" file that contains "Basic Site"
When I run jekyll
Then the _site directory should exist
And I should see "Basic Site" in "_site/index.html"
Scenario: Basic site with a post
Given I have a blank site
And I have a _posts directory
Given I have a _posts directory
And I have the following post:
| title | date | content |
| Hackers | 3/27/2009 | My First Exploit |
@ -21,8 +19,7 @@ Feature: Create sites
And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
Scenario: Basic site with layout and a page
Given I have a blank site
And I have a _layouts directory
Given I have a _layouts directory
And I have an "index.html" file with layout "default" that contains "Basic Site with Layout"
And I have a default layout that contains "Page Layout: {{ content }}"
When I run jekyll
@ -30,8 +27,7 @@ Feature: Create sites
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
Given I have a _layouts directory
And I have a _posts directory
And I have the following post:
| title | date | layout | content |
@ -42,8 +38,7 @@ Feature: Create sites
And I should see "Post Layout: Would you like to play a game?" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with include tag
Given I have a blank site
And I have a _includes directory
Given I have a _includes directory
And I have an "index.html" file that contains "Basic Site with include tag: {% include about.html %}"
And I have an "_includes/about.html" file that contains "Generated by Jekyll"
When I run jekyll

View File

@ -1,17 +1,37 @@
Given /^I have a blank site(?: in (.*))?$/ do |dir|
pending
Before do
FileUtils.mkdir(TEST_DIR)
Dir.chdir(TEST_DIR)
end
Given /^I have an "(.*)" file( with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
pending
After do
Dir.chdir(TEST_DIR)
FileUtils.rm_rf(TEST_DIR)
end
Given /^I have an "(.*)" file(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
File.open(file, 'w') do |f|
if key && value
f.write <<EOF
---
#{key}: #{value}
---
EOF
end
f.write(text)
f.close
end
end
Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
pending
File.open(layout, 'w') do |f|
f.write(text)
f.close
end
end
Given /^I have a (.*) directory$/ do |dir|
pending
FileUtils.mkdir(dir)
end
Given /^I have the following posts?(?: in "(.*)")?:$/ do |table, dir|
@ -23,7 +43,7 @@ Given /^I have a configuration file(?: in "(.*)")? with "(.*)" set to "(.*)"$/ d
end
When /^I run jekyll$/ do
pending
`#{File.join(ENV['PWD'], 'bin', 'jekyll')} >> /dev/null`
end
When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
@ -35,7 +55,7 @@ When /^I go to "(.*)"$/ do |address|
end
Then /^the (.*) directory should exist$/ do |dir|
pending
pending
end
Then /^I should see "(.*)"(?: in "(.*)")?$/ do |text, file|

4
features/support/env.rb Normal file
View File

@ -0,0 +1,4 @@
require 'fileutils'
require 'rr'
TEST_DIR = File.join('/', 'tmp', 'jekyll')