# Override the default rails 'rake test' command to start depe

**URL:** <https://www.ruby-forum.com/t/override-the-default-rails-rake-test-command-to-start-depe/111232>\
**Category:** Rails\
**Created:** [August 4, 2007, 2:41am UTC](https://www.ruby-forum.com/t/override-the-default-rails-rake-test-command-to-start-depe/111232 "2007-08-04T02:41:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidjrice](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5e9695/32.png) [@davidjrice](https://www.ruby-forum.com/u/davidjrice)\
**Post date:** [August 4, 2007, 2:41am UTC](https://www.ruby-forum.com/t/override-the-default-rails-rake-test-command-to-start-depe/111232/1 "2007-08-04T02:41:28Z")

</div>

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 🙂

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

* * *

David Rice  
[http://www.davidjrice.co.uk](http://www.davidjrice.co.uk)

---

<div class="post-metadata">

**Author:** ![davidjrice](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5e9695/32.png) [@davidjrice](https://www.ruby-forum.com/u/davidjrice)\
**Post date:** [August 4, 2007, 3:52am UTC](https://www.ruby-forum.com/t/override-the-default-rails-rake-test-command-to-start-depe/111232/2 "2007-08-04T03:52:36Z")

</div>

On Aug 3, 2007, at 19:40 , David Rice wrote:

> 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 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](http://snippets.dzone.com/posts/show/2032)

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![davidjrice](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5e9695/32.png) [@davidjrice](https://www.ruby-forum.com/u/davidjrice)\
**Post date:** [August 4, 2007, 10:00pm UTC](https://www.ruby-forum.com/t/override-the-default-rails-rake-test-command-to-start-depe/111232/3 "2007-08-04T22:00:56Z")

</div>

Excellent, thanks Michael just what I was looking for!

I guess redefine was the magic word I didn’t try. 🙂
