Skip to content

Instantly share code, notes, and snippets.

@dugsmith
Created March 7, 2013 16:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dugsmith/5109137 to your computer and use it in GitHub Desktop.
Save dugsmith/5109137 to your computer and use it in GitHub Desktop.
Example Capistrano configuration to run RSpec tests on build instance
role :app, 'your-build-server-ip'
set :scm, :git
set :repository, "your-git-repo-url"
set :user, 'your-user-name'
set :deploy_to, "/Users/#{user}/deployments/build/#{application}"
set :deploy_via, :export
set :branch, 'master'
set :rails_env, 'build'
namespace :deploy do
desc "Make sure all specs pass"
task :check_specs do
begin
puts "Updating dependencies..."
run "cd #{release_path} && bundle install"
puts "Generating test database..."
run "cd #{release_path} && rake db:setup RAILS_ENV=test"
puts "Checking specs..."
system("cd #{release_path} && bundle exec rspec .") or raise "One or more specs are failing. Come back when they all pass."
@failed = false
rescue Exception => e
puts e
@failed = true
end
abort if @failed
end
end
before 'deploy:assets:symlink', 'deploy:check_specs'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment