1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00
capistrano/spec/integration/installation_spec.rb
seenmyfate f5a585b3a4 Add integration tests for deploy task
This commit adds the outlines of a testing framework for Cap tasks.
Currently just the `cap install` and `cap deploy` tasks are covered. For
now, these tests can only be run if it is `ssh localhost` will work for
you and are currently excluded from the suite. It is my intention to
eventually replace the `sshkit` backend with a test backend, but for now
this is good enough to prevent simple regressions.
2013-06-16 13:08:15 +01:00

76 lines
2.1 KiB
Ruby

require 'integration_spec_helper'
describe 'cap install', slow: true do
context 'with defaults' do
before :all do
create_test_app
Dir.chdir(test_app_path) do
%x[bundle exec cap install]
end
end
describe 'installation' do
it 'creates config/deploy' do
path = test_app_path.join('config/deploy')
expect(Dir.exists?(path)).to be_true
end
it 'creates lib/capistrano/tasks' do
path = test_app_path.join('lib/capistrano/tasks')
expect(Dir.exists?(path)).to be_true
end
it 'creates the deploy file' do
file = test_app_path.join('config/deploy.rb')
expect(File.exists?(file)).to be_true
end
it 'creates the stage files' do
staging = test_app_path.join('config/deploy/staging.rb')
production = test_app_path.join('config/deploy/production.rb')
expect(File.exists?(staging)).to be_true
expect(File.exists?(production)).to be_true
end
end
end
context 'with STAGES' do
before :all do
create_test_app
Dir.chdir(test_app_path) do
%x[bundle exec cap install STAGES=qa,production]
end
end
describe 'installation' do
it 'creates config/deploy' do
path = test_app_path.join('config/deploy')
expect(Dir.exists?(path)).to be_true
end
it 'creates lib/capistrano/tasks' do
path = test_app_path.join('lib/capistrano/tasks')
expect(Dir.exists?(path)).to be_true
end
it 'creates the deploy file' do
file = test_app_path.join('config/deploy.rb')
expect(File.exists?(file)).to be_true
end
it 'creates the stage files specified, not the defaults' do
qa = test_app_path.join('config/deploy/qa.rb')
production = test_app_path.join('config/deploy/production.rb')
staging = test_app_path.join('config/deploy/staging.rb')
expect(File.exists?(qa)).to be_true
expect(File.exists?(production)).to be_true
expect(File.exists?(staging)).to be_false
end
end
end
end