Permalink
Browse files

Add a test for an actual deployment.

  • Loading branch information...
1 parent 83f4a6e commit 551224c858ad183e16c2deec26f993267df9cf85 @rstacruz rstacruz committed Jun 4, 2012
Showing with 43 additions and 1 deletion.
  1. +1 −1 .rspec
  2. +5 −0 spec/command_helper.rb
  3. +37 −0 spec/commands/real_deploy_spec.rb
View
@@ -1 +1 @@
--c --order rand
+-c --order rand -t ~ssh
@@ -22,6 +22,11 @@ def run_command(*args)
# Invokes the main 'vh' command and ensures the exit status is success.
def vh(*args)
run_command *args
+ if exitstatus != 0 && ENV['verbose']
+ puts stdout
+ puts stderr
+ end
+
exitstatus.should == 0
end
@@ -0,0 +1,37 @@
+require 'spec_helper'
+require 'command_helper'
+require 'fileutils'
+
+describe "Invoking the 'vh' command in a project", ssh: true do
+ before :each do
+ Dir.chdir root('test_env')
+ FileUtils.rm_rf './deploy'
+ FileUtils.mkdir_p './deploy'
+ end
+
+ it 'should set up and deploy fine' do
+ print "[setup]" if ENV['verbose']
+ vh 'setup', '--verbose'
+ File.directory?('deploy').should be_true
+ File.directory?('deploy/releases').should be_true
+ File.directory?('deploy/shared').should be_true
+ File.exists?('deploy/last_version').should be_false
+ File.exists?('deploy/deploy.lock').should be_false
+
+ print "[deploy 1]" if ENV['verbose']
+ vh 'deploy', '--verbose'
+ File.exists?('deploy/last_version').should be_true
+ File.exists?('deploy/deploy.lock').should be_false
+ File.directory?('deploy/releases').should be_true
+ File.directory?('deploy/releases/1').should be_true
+ File.directory?('deploy/releases/2').should be_false
+ File.exists?('deploy/current').should be_true
+ File.read('deploy/last_version').strip.should == '1'
+
+ # And again
+ print "[deploy 2]" if ENV['verbose']
+ vh 'deploy', '--verbose'
+ File.directory?('deploy/releases/2').should be_true
+ File.read('deploy/last_version').strip.should == '2'
+ end
+end

0 comments on commit 551224c

Please sign in to comment.