Fix builder steps to properly copy configs, and add a new scenario that shows build --clean not working right when the build directory is set to a nested path. When a path is ignored, it doesn't get removed - in fact, no unused paths will get removed, this is just the easiest way to show it in a test.

This commit is contained in:
Ben Hollis 2012-01-04 00:20:25 -08:00
parent 4bf65e063a
commit c5063c1e35
5 changed files with 35 additions and 16 deletions

View file

@ -3,29 +3,39 @@ Feature: Build Clean
Given a fixture app "clean-app"
And app "clean-app" is using config "empty"
And a successfully built app at "clean-app"
Then the following files should exist:
| build/index.html |
| build/should_be_ignored.html |
| build/should_be_ignored2.html |
| build/should_be_ignored3.html |
And app "clean-app" is using config "complications"
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"
| build/should_be_ignored.html |
| build/should_be_ignored2.html |
| build/should_be_ignored3.html |
And the file "build/index.html" should contain "Comment in layout"
Scenario: Clean an app with directory indexes
Given a successfully built app at "clean-dir-app"
When I cd to "build"
Then the following files should exist:
| about/index.html |
| build/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 |
| build/about/index.html |
Scenario: Clean build an app that's never been built
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 |
| build/about/index.html |
Scenario: Clean build an app with newly ignored files and a nested output directory
Given a built app at "clean-nested-app"
Then a directory named "sub/dir" should exist
Then the following files should exist:
| sub/dir/about.html |
When I append to "config.rb" with "ignore 'about.html'"
Given a built app at "clean-nested-app" with flags "--clean"
Then the following files should not exist:
| sub/dir/about.html |

View file

@ -1 +1,2 @@
activate :directory_indexes

View file

@ -0,0 +1,3 @@
set :build_dir, "sub/dir"

View file

@ -0,0 +1 @@
Fun times

View file

@ -2,12 +2,16 @@ 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_path = File.join(current_dir, "config-#{config_name}.rb")
config_dest = File.join(current_dir, "config.rb")
FileUtils.cp(config_path, config_dest)
end
Given /^a fixture app "([^\"]*)"$/ do |path|
# This step can be reentered from several places but we don't want
# to keep re-copying and re-cd-ing into ever-deeper directories
next if File.basename(current_dir) == path
step %Q{a directory named "#{path}"}
target_path = File.join(PROJECT_ROOT_PATH, "fixtures", path)