Sha256: 1c72bf1f177e942dde883d6395ceb09bef774397b04372910bfc427c3fca435f

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

namespace :deploy do
  desc "Runs test before deploying, and don't deploy unless they pass"
  task :run_tests do
    test_log = "log/capistrano.test.log"
    tests = fetch(:tests)
    if tests&.any?
      tests.each do |test|
        puts "--> Running tests: '#{test}', please wait ..."
        unless system "bundle exec rspec #{test} > #{test_log} 2>&1"
          puts "--> Tests: '#{test}' failed. Results in: #{test_log} and below:"
          system "cat #{test_log}"
          exit;
        end
        puts "--> '#{test}' passed"
      end
      puts "--> All tests passed"
      system "rm #{test_log}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meataxe-0.6.2 lib/meataxe/capistrano/tasks/run_tests.cap