-
-
Save SunDi3yansyah/084f095a03eaecdb1f420c4b7a114fc9 to your computer and use it in GitHub Desktop.
Example Capistrano configuration to run RSpec tests on build instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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