Kavi
Kavi

Reputation: 174

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 ?

Upvotes: 2

Views: 1465

Answers (1)

Rajarshi Das
Rajarshi Das

Reputation: 12320

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

Upvotes: 3

Related Questions