extend feature tests and use scenario outline

This commit is contained in:
maul.esel 2013-09-16 15:19:29 +02:00
parent bec4a07c12
commit 0f4d646510
2 changed files with 26 additions and 23 deletions

View File

@ -18,27 +18,26 @@ Feature: Site configuration
Then the _mysite directory should exist Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html" And I should see "Changing destination directory" in "_mysite/index.html"
Scenario: Similarly named source and destination Scenario Outline: Similarly named source and destination
Given I have a blank site in "mysite_source" Given I have a blank site in "<source>"
And I have an "mysite_source/index.html" file that contains "html" And I have an "<source>/index.md" page that contains "markdown"
And I have a configuration file with: And I have a configuration file with:
| key | value | | key | value |
| source | mysite_source | | source | <source> |
| destination | mysite | | destination | <dest> |
When I run jekyll When I run jekyll
Then the mysite directory should exist Then the <source> directory should exist
And I should see "html" in "mysite/index.html" And the "<dest>/index.html" file should <file_exist> exist
And I should see "markdown" in "<source>/index.md"
Scenario: Similarly named source and destination 2 Examples:
Given I have a blank site in "mysite" | source | dest | file_exist |
And I have an "mysite/index.html" file that contains "html" | mysite_source | mysite | |
And I have a configuration file with: | mysite | mysite_dest | |
| key | value | | mysite/ | mysite | not |
| source | mysite | | mysite | ./mysite | not |
| destination | mysite_dest | | mysite/source | mysite | not |
When I run jekyll | mysite | mysite/dest | |
Then the mysite_dest directory should exist
And I should see "html" in "mysite_dest/index.html"
Scenario: Exclude files inline Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded" Given I have an "Rakefile" file that contains "I want to be excluded"

View File

@ -7,7 +7,7 @@ end
World(Test::Unit::Assertions) World(Test::Unit::Assertions)
Given /^I have a blank site in "(.*)"$/ do |path| Given /^I have a blank site in "(.*)"$/ do |path|
FileUtils.mkdir(path) FileUtils.mkdir_p(path)
end end
Given /^I do not have a "(.*)" directory$/ do |path| Given /^I do not have a "(.*)" directory$/ do |path|
@ -137,10 +137,14 @@ When /^I delete the file "(.*)"$/ do |file|
File.delete(file) File.delete(file)
end end
Then /^the (.*) directory should exist$/ do |dir| Then /^the (.*) directory should +exist$/ do |dir|
assert File.directory?(dir), "The directory \"#{dir}\" does not exist" assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
end end
Then /^the (.*) directory should not exist$/ do |dir|
assert !File.directory?(dir), "The directory \"#{dir}\" exists"
end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file| Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(text).match(File.open(file).readlines.join) assert Regexp.new(text).match(File.open(file).readlines.join)
end end
@ -157,12 +161,12 @@ Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join) assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
end end
Then /^the "(.*)" file should exist$/ do |file| Then /^the "(.*)" file should +exist$/ do |file|
assert File.file?(file) assert File.file?(file), "The file \"#{file}\" does not exist"
end end
Then /^the "(.*)" file should not exist$/ do |file| Then /^the "(.*)" file should not exist$/ do |file|
assert !File.exists?(file) assert !File.exists?(file), "The file \"#{file}\" exists"
end end
Then /^I should see today's time in "(.*)"$/ do |file| Then /^I should see today's time in "(.*)"$/ do |file|