mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
84407c63a7
Previously, a fully-configured app was used as the background for the `cap install` feature tests. This somewhat defeated the purpose of these tests, because `cap install` is supposed to be run on a project that hasn't yet been "capified".
62 lines
1.8 KiB
Ruby
62 lines
1.8 KiB
Ruby
Given(/^a test app with the default configuration$/) do
|
|
TestApp.install
|
|
end
|
|
|
|
Given(/^a test app without any configuration$/) do
|
|
TestApp.create_test_app
|
|
end
|
|
|
|
Given(/^servers with the roles app and web$/) do
|
|
begin
|
|
vagrant_cli_command("up")
|
|
rescue
|
|
nil
|
|
end
|
|
end
|
|
|
|
Given(/^a linked file "(.*?)"$/) do |file|
|
|
# ignoring other linked files
|
|
TestApp.append_to_deploy_file("set :linked_files, ['#{file}']")
|
|
end
|
|
|
|
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}")
|
|
end
|
|
|
|
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}")
|
|
end
|
|
|
|
Given(/^a custom task to generate a file$/) do
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/database.rake")
|
|
end
|
|
|
|
Given(/^a task which executes as root$/) do
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/root.rake")
|
|
end
|
|
|
|
Given(/config stage file has line "(.*?)"/) do |line|
|
|
TestApp.append_to_deploy_file(line)
|
|
end
|
|
|
|
Given(/^the configuration is in a custom location$/) do
|
|
TestApp.move_configuration_to_custom_location("app")
|
|
end
|
|
|
|
Given(/^a custom task that will simulate a failure$/) do
|
|
safely_remove_file(TestApp.shared_path.join("failed"))
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/fail.rake")
|
|
end
|
|
|
|
Given(/^a custom task to run in the event of a failure$/) do
|
|
safely_remove_file(TestApp.shared_path.join("failed"))
|
|
TestApp.copy_task_to_test_app("spec/support/tasks/failed.rake")
|
|
end
|
|
|
|
Given(/^a stage file named (.+)$/) do |filename|
|
|
TestApp.write_local_stage_file(filename)
|
|
end
|