Override the default rails 'rake test' command to start dependencies

Hey guys,

I'd like to be able to override the default test task with something that starts the dependencies required for testing our app. I've been googling a bit and playing around with rake but I can't get it to play ball.

I put a file in lib/tasks/testing.rake with the following command.

Does anyone know a solution for doing something like this? I'm sure this must be a common thing :slight_smile:

Thanks, Dave

desc 'Test all units and functionals' task :test do   puts "Starting ferret server..."   system "RAILS_ENV=test script/ferret_start"   exceptions = ["test:units", "test:functionals", "test:integration"].collect do |task|     begin       Rake::Task[task].invoke       nil     rescue => e       e     end   end.compact

  exceptions.each {|e| puts e;puts e.backtrace }   raise "Test failures" unless exceptions.empty? end

I've found this useful in the past for redefining tasks (third item when I google for "rake redefine tasks")

http://snippets.dzone.com/posts/show/2032

Michael Glaesemann grzm seespotcode net

Excellent, thanks Michael just what I was looking for!

I guess redefine was the magic word I didn't try. :slight_smile: