浏览 1858 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-03-29
最后修改:2009-03-29
rake db:test:purge rake db:migrate rake test 但是,默认情况下CruiseControl在执行build的时候仍然执行Rails自带的test cases所以我们可以做如下的改变,使得CruiseControl能够调用RSpec的测试. 那么,创建如下的rake任务: RAILS_ROOT/lib/tasks/custom_cc.rake desc 'Custom curise task for RSpec' task :cruise do ENV['RAILS_ENV'] = 'test' if File.exists?(Dir.pwd + "/config/database.yml") if Dir[Dir.pwd + "/db/migrate/*.rb"].empty? raise "No migration scripts found in db/migrate/ but database.yml exists, " + "CruiseControl won't be able to build the latest test database. Build aborted." end #perform standard Rails database cleanup/preparation tasks if they are defined in project #this is necessary because there is no up-to-date development database on a continuous integration box if Rake.application.lookup('db:test:purge') CruiseControl::invoke_rake_task 'db:test:purge' end if Rake.application.lookup('db:migrate') CruiseControl::reconnect CruiseControl::invoke_rake_task 'db:migrate' end end CruiseControl::invoke_rake_task 'spec:all' end 这样,CruiseControl.rb就可以在build的时候调用RSpec了. 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |