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

View File

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