2013-09-27 06:45:55 -04:00
|
|
|
Given(/^a test app with the default configuration$/) do
|
|
|
|
TestApp.install
|
|
|
|
end
|
|
|
|
|
|
|
|
Given(/^servers with the roles app and web$/) do
|
2016-03-01 10:34:31 -05:00
|
|
|
begin
|
|
|
|
vagrant_cli_command("up")
|
|
|
|
rescue
|
|
|
|
nil
|
|
|
|
end
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
2014-04-26 07:27:24 -04:00
|
|
|
Given(/^a linked file "(.*?)"$/) do |file|
|
|
|
|
# ignoring other linked files
|
|
|
|
TestApp.append_to_deploy_file("set :linked_files, ['#{file}']")
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
2014-04-26 07:27:24 -04:00
|
|
|
Given(/^file "(.*?)" exists in shared path$/) do |file|
|
|
|
|
file_shared_path = TestApp.shared_path.join(file)
|
|
|
|
run_vagrant_command("mkdir -p #{TestApp.shared_path}")
|
|
|
|
run_vagrant_command("touch #{file_shared_path}")
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
2014-04-26 07:27:24 -04:00
|
|
|
Given(/^file "(.*?)" does not exist in shared path$/) do |file|
|
|
|
|
file_shared_path = TestApp.shared_path.join(file)
|
|
|
|
run_vagrant_command("mkdir -p #{TestApp.shared_path}")
|
|
|
|
run_vagrant_command("touch #{file_shared_path} && rm #{file_shared_path}")
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Given(/^a custom task to generate a file$/) do
|
2016-02-28 18:16:11 -05:00
|
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/database.rake")
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
2015-02-12 20:34:09 -05:00
|
|
|
Given(/^a task which executes as root$/) do
|
2016-02-28 18:16:11 -05:00
|
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/root.rake")
|
2015-02-12 20:34:09 -05:00
|
|
|
end
|
|
|
|
|
2014-01-18 16:18:55 -05:00
|
|
|
Given(/config stage file has line "(.*?)"/) do |line|
|
|
|
|
TestApp.append_to_deploy_file(line)
|
|
|
|
end
|
|
|
|
|
2013-10-11 12:24:37 -04:00
|
|
|
Given(/^the configuration is in a custom location$/) do
|
2016-02-28 18:16:11 -05:00
|
|
|
TestApp.move_configuration_to_custom_location("app")
|
2013-10-11 12:24:37 -04:00
|
|
|
end
|
2013-11-01 07:59:13 -04:00
|
|
|
|
|
|
|
Given(/^a custom task that will simulate a failure$/) do
|
2016-02-28 18:16:11 -05:00
|
|
|
safely_remove_file(TestApp.shared_path.join("failed"))
|
|
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/fail.rake")
|
2013-11-01 07:59:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Given(/^a custom task to run in the event of a failure$/) do
|
2016-02-28 18:16:11 -05:00
|
|
|
safely_remove_file(TestApp.shared_path.join("failed"))
|
|
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/failed.rake")
|
2013-11-01 07:59:13 -04:00
|
|
|
end
|