使用capistrano在部署时自动运行测试

Ian*_*Ian 7 unit-testing capistrano ruby-on-rails

有没有办法让我在运行时在我的Rails应用程序上运行单元测试cap deploy,如果它们没有通过则会失败?我知道这可以并且应该由部署人员来完成,但我希望它是自动的.任何想法将不胜感激.

提前致谢!

编辑:我最终使用作为解决方案.

Ian*_*Ian 4

此 capistrano 任务将在生产模式下在正在部署的服务器上运行单元测试:

desc "Run the full tests on the deployed app." 
task :run_tests do
 run "cd #{release_path} && RAILS_ENV=production rake && cat /dev/null > log/test.log" 
end
Run Code Online (Sandbox Code Playgroud)

在这里找到解决方案: http: //marklunds.com/articles/one/338

:D