2013-06-16 08:08:15 -04:00
|
|
|
require 'integration_spec_helper'
|
2013-06-14 12:09:32 -04:00
|
|
|
|
2013-08-02 06:09:07 -04:00
|
|
|
describe 'cap install' do
|
2013-06-14 11:52:37 -04:00
|
|
|
|
|
|
|
context 'with defaults' do
|
|
|
|
before :all do
|
2013-06-14 12:09:32 -04:00
|
|
|
create_test_app
|
2013-06-14 11:52:37 -04:00
|
|
|
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
|
2013-06-14 12:09:32 -04:00
|
|
|
create_test_app
|
2013-06-14 11:52:37 -04:00
|
|
|
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
|
|
|
|
|
2013-06-16 08:08:15 -04:00
|
|
|
it 'creates the stage files specified, not the defaults' do
|
2013-06-14 11:52:37 -04:00
|
|
|
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
|