当我运行“rake test:integration”时,它正在调用“db:test:load => db:test:purge”。我不想重新创建数据库,只想在不接触数据库的情况下运行测试用例。有什么办法吗?
问问题
1082 次
1 回答
3
和我的评论一样
对于您的情况,它将类似于:-
在您的 Rakefile 中:
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
在 lib/tasks/db/test.rake 中:
Rake.application.remove_task 'db:test:load'
Rake.application.remove_task 'db:test:purge'
namespace :db do
namespace :test do
task :load do |t|
# rewrite the task to not do anything you don't want
end
task :purge do |t|
# rewrite the task to not do anything you don't want
end
end
end
于 2013-09-09T12:28:52.240 回答