简体   繁体   中英

run “db:test:load => db:test:purge” without resetting database

When I am running "rake test:integration" it is calling "db:test:load => db:test:purge". I dont want to recreate database, just want to run test cases without touching database. Is the any way to do it ?

It will be same like as my comments

For your case It will be something like:-

In your Rakefile:

Rake::TaskManager.class_eval do
  def remove_task(task_name)
   @tasks.delete(task_name.to_s)
 end
end

In 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM