Running RSpec tests before deploying with Capistrano v3
For small projects which do not have CI integration, RSpec tests can be run just before deployment. So you will be always sure that you are not deploying bad code at any time.
Add this code in your
before :starting, :run_tests do puts 'Running tests before deploy' unless system 'rspec' puts 'Tests are failed deployment is being aborted' exit; end end