directory_indexes feature, some builder rename middleware and a bunch of test case cleanup. closes #63

This commit is contained in:
Thomas Reynolds 2011-07-27 19:59:38 -07:00
parent c35a6fc369
commit 5602e35c88
38 changed files with 231 additions and 104 deletions

View file

@ -1,35 +1,39 @@
require 'fileutils'
require 'middleman/cli'
Given /^a built test app$/ do
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
Given /^a built app at "([^"]*)"$/ do |path|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path)
build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
`cd #{target} && #{build_cmd}`
end
Then /^cleanup built app at "([^"]*)"$/ do |path|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path, "build")
FileUtils.rm_rf(target)
end
Given /^a built test app with flags "([^"]*)"$/ do |flags|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
`cd #{target} && #{build_cmd} #{flags}`
end
Given /^cleanup built test app$/ do
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build")
FileUtils.rm_rf(target)
end
Then /^"([^"]*)" should exist$/ do |target_file,|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
Then /^"([^"]*)" should exist at "([^"]*)"$/ do |target_file, path|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path, "build", target_file)
File.exists?(target).should be_true
end
Then /^"([^"]*)" should exist and include "([^"]*)"$/ do |target_file, expected|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
Then /^"([^"]*)" should exist at "([^"]*)" and include "([^"]*)"$/ do |target_file, path, expected|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path, "build", target_file)
File.exists?(target).should be_true
File.read(target).should include(expected)
end
Then /^"([^"]*)" should not exist$/ do |target_file|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
Then /^"([^"]*)" should not exist at "([^"]*)"$/ do |target_file, path|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
target = File.join(root, "fixtures", path, "build", target_file)
File.exists?(target).should be_false
end

View file

@ -15,9 +15,10 @@ Given /^current environment is "([^\"]*)"$/ do |env|
@current_env = env.to_sym
end
Given /^the Server is running$/ do
Given /^the Server is running at "([^\"]*)"$/ do |app_path|
@server ||= Middleman.server
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
root = File.dirname(File.dirname(File.dirname(__FILE__)))
@server.set :root, File.join(root, "fixtures", app_path)
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
end