1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00
middleman--middleman/features/step_definitions/builder_steps.rb

35 lines
1.5 KiB
Ruby
Raw Normal View History

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", "mm build"))
`cd #{target} && #{build_cmd}`
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", "mm 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
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
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
end