fix clean tests

This commit is contained in:
Thomas Reynolds 2011-12-15 16:33:09 -08:00
parent 151c47672e
commit 43e6d669b5
5 changed files with 46 additions and 47 deletions

View file

@ -2,10 +2,7 @@ Feature: Builder
In order to output static html and css for delivery
Scenario: Checking built folder for content
Given a built app at "test-app"
Then a directory named "build" should exist
And the exit status should be 0
Given a successfully built app at "test-app"
When I cd to "build"
Then the following files should exist:
| index.html |
@ -38,10 +35,7 @@ Feature: Builder
And the file "spaces in file.html" should contain "spaces"
Scenario: Build glob
Given a built app at "glob-app" with flags "--glob '*.css'"
Then a directory named "build" should exist
And the exit status should be 0
Given a successfully built app at "glob-app" with flags "--glob '*.css'"
When I cd to "build"
Then the following files should not exist:
| index.html |

View file

@ -9,11 +9,7 @@ Feature: Templates should be chainable
And I should see "Sup</h3>"
Scenario: Build chained template
Given a built app at "chained-app"
Then a directory named "build" should exist
And the exit status should be 0
Given a successfully built app at "chained-app"
When I cd to "build"
Then the following files should exist:
| index.html |

View file

@ -1,19 +1,31 @@
Feature: Build Clean
Scenario: Build and Clean an app
Given app "clean-app" is using config "empty"
And a built app at "clean-app"
Given a fixture app "clean-app"
And app "clean-app" is using config "empty"
And a successfully built app at "clean-app"
And app "clean-app" is using config "complications"
And a built app at "clean-app" with flags "--clean"
Then "should_be_ignored.html" should not exist at "clean-app"
And "should_be_ignored2.html" should not exist at "clean-app"
And "should_be_ignored3.html" should not exist at "clean-app"
Given a successfully built app at "clean-app" with flags "--clean"
When I cd to "build"
Then the following files should not exist:
| should_be_ignored.html |
| should_be_ignored2.html |
| should_be_ignored3.html |
And the file "index.html" should contain "Comment in layout"
Scenario: Clean an app with directory indexes
Given a built app at "clean-dir-app"
Then "about/index.html" should exist at "clean-dir-app"
Given a built app at "clean-dir-app" with flags "--clean"
Then "about/index.html" should exist at "clean-dir-app"
Given a successfully built app at "clean-dir-app"
When I cd to "build"
Then the following files should exist:
| about/index.html |
Given a successfully built app at "clean-dir-app" with flags "--clean"
When I cd to "build"
Then the following files should exist:
| about/index.html |
Scenario: Clean build an app that's never been built
Given a built app at "clean-dir-app" with flags "--clean"
Then "about/index.html" should exist at "clean-dir-app"
Given a successfully built app at "clean-dir-app" with flags "--clean"
When I cd to "build"
Then the following files should exist:
| about/index.html |

View file

@ -1,8 +1,11 @@
Feature: Custom Layout Engine
Scenario: Checking built folder for content
Given a built app at "custom-layout-app"
Then "index.html" should exist at "custom-layout-app" and include "Comment in layout"
Given a successfully built app at "custom-layout-app"
When I cd to "build"
Then the following files should exist:
| index.html |
And the file "index.html" should contain "Comment in layout"
Scenario: Checking server for content
Given the Server is running at "test-app"

View file

@ -3,7 +3,7 @@ require 'fileutils'
Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path)
config_path = File.join(target, "config-#{config_name}.rb")
config_dest = File.join(target, "config.rb")
config_dest = File.join(current_dir, "config.rb")
FileUtils.cp(config_path, config_dest)
end
@ -21,28 +21,22 @@ Given /^a built app at "([^\"]*)"$/ do |path|
step %Q{I run `middleman build`}
end
Given /^was successfully built$/ do
step %Q{a directory named "build" should exist}
step %Q{the exit status should be 0}
end
Given /^a successfully built app at "([^\"]*)"$/ do |path|
step %Q{a built app at "#{path}"}
step %Q{was successfully built}
end
Given /^a built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path, flags|
step %Q{a fixture app "#{path}"}
step %Q{I run `middleman build #{flags}`}
end
Then /^"([^\"]*)" should exist at "([^\"]*)"$/ do |target_file, path|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path, "build", target_file)
File.exists?(target).should be_true
end
Then /^"([^\"]*)" should exist at "([^\"]*)" and include "([^\"]*)"$/ do |target_file, path, expected|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path, "build", target_file)
File.exists?(target).should be_true
File.read(target).should include(expected)
end
Then /^"([^\"]*)" should not exist at "([^\"]*)"$/ do |target_file, path|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path, "build", target_file)
File.exists?(target).should be_false
end
Then /^the last exit code should be "([^\"]*)"$/ do |exit_code|
exit_code = exit_code.to_i
$?.exitstatus.should == exit_code
Given /^a successfully built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path, flags|
step %Q{a built app at "#{path}" with flags "#{flags}"}
step %Q{was successfully built}
end