如何向TestTask声明任务依赖?
在此示例中,应在集成任务
之前运行“clean_database”任务Rake::TestTask.new(:integration) do |t|
t.libs << "test"
t.test_files = FileList['test/**/integration/**/test*.rb']
t.verbose = true
end
task :clean_database => [:init] do
#...
end
答案 0 :(得分:20)
Rake可以重新定义现有任务,因此应该可以(将其添加到现有代码中):
task :integration => :clean_database
答案 1 :(得分:8)
您可以将依赖项传递给TestTask初始值设定项:
Rake::TestTask.new(:integration => :clean_database) do |t|
t.libs << "test"
t.test_files = FileList['test/**/integration/**/test*.rb']
t.verbose = true
end