rubyrakerake-test

Add task dependencies to Rake::TestTask


How can I declare task dependencies to a TestTask ?

In this example, 'clean_database' task should be run before integration task

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

Solution

  • Rake enables redefining existing tasks, so this should be possible (add it to your existing code):

    task :integration => :clean_database