2010-09-06 13:59:51 -04:00
|
|
|
require 'fileutils'
|
2011-07-27 02:19:43 -04:00
|
|
|
require 'middleman/cli'
|
2010-09-06 13:59:51 -04:00
|
|
|
|
|
|
|
Given /^a built test app$/ do
|
|
|
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
2011-07-27 04:45:57 -04:00
|
|
|
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
|
2011-07-27 02:19:43 -04:00
|
|
|
`cd #{target} && #{build_cmd}`
|
2010-09-06 13:59:51 -04:00
|
|
|
end
|
|
|
|
|
2011-04-19 17:24:21 -04:00
|
|
|
Given /^a built test app with flags "([^"]*)"$/ do |flags|
|
|
|
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
2011-07-27 04:45:57 -04:00
|
|
|
build_cmd = File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "bin", "middleman build"))
|
2011-07-27 02:19:43 -04:00
|
|
|
`cd #{target} && #{build_cmd} #{flags}`
|
2011-04-19 17:24:21 -04:00
|
|
|
end
|
|
|
|
|
2010-09-06 13:59:51 -04:00
|
|
|
Given /^cleanup built test app$/ do
|
|
|
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build")
|
2011-07-10 18:10:49 -04:00
|
|
|
FileUtils.rm_rf(target)
|
2010-09-06 13:59:51 -04:00
|
|
|
end
|
|
|
|
|
2011-07-22 14:43:00 -04:00
|
|
|
Then /^"([^"]*)" should exist$/ do |target_file,|
|
|
|
|
target = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app", "build", target_file)
|
|
|
|
File.exists?(target).should be_true
|
|
|
|
end
|
|
|
|
|
2010-09-06 13:59:51 -04:00
|
|
|
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)
|
|
|
|
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)
|
|
|
|
File.exists?(target).should be_false
|
2011-05-31 01:33:11 -04:00
|
|
|
end
|