# Rake problem -- overriding test task

**URL:** <https://www.ruby-forum.com/t/rake-problem-overriding-test-task/128916>\
**Category:** Rails\
**Created:** [February 12, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/rake-problem-overriding-test-task/128916 "2008-02-12T17:28:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpwood](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/d6d6ee/32.png) [@wpwood](https://www.ruby-forum.com/u/wpwood)\
**Post date:** [February 12, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/rake-problem-overriding-test-task/128916/1 "2008-02-12T17:28:23Z")

</div>

I’ve got a test suite that runs fine from the command line but fails  
from rake. We’ve got a database table in our app that causes  
db:test:clone to fail. From the command line, db:test:clone\_structure  
works ok, so I tried to override db:test:clone in the Rakefile. When I  
‘rake test’, the unit tests run successfully, but the integration tests  
all fail (they all run successfully from the command line). I’ll copy  
the Rakefile below. If anybody’s got any ideas about what I might be  
doing wrong, I’d really appreciate hearing them.

Thanks,  
Bill

======== Rakefile =========  
require(File.join(File.dirname( **FILE** ), ‘config’, ‘boot’))

require ‘rake’  
require ‘rake/testtask’  
require ‘rake/rdoctask’  
require ‘tasks/rails’

# don’t clone the test database; use clone\_structure

# so Rake doesn’t abort on the fulltext index

Rake::TaskManager.class\_eval do  
def delete\_task(task\_name)  
@tasks.delete(task\_name.to\_s)  
end  
Rake.application.delete\_task(“db:test:clone”)  
end  
namespace :db do  
namespace :test do  
task :clone do  
Rake::Task[“db:test:clone\_structure”].invoke  
end  
end  
end
