Every time I run test. Rails will delete my data from table. I have million of record in my table for testing search performance and corrective. I can't add data every time I run test.
How to tell rails "Please don't delete data in this table" when i run test.
ps.
I found this link
How do I run Rails integration tests without dropping DB contents?
It's maybe relate to my problems but I don't know where to put his code in my rails project.
Very similar to neokain's previous post, however, his didn't work on Rails 3 for me. I went ahead and dropped this into my Rakefile at the root of the app and when I run test:units, it doesn't blow away all of my existing tables:
Rake::TaskManager.class_eval do
def delete_task(task_name)
@tasks.delete(task_name.to_s)
end
Rake.application.delete_task("db:test:purge")
Rake.application.delete_task("db:test:prepare")
end
namespace :db do
namespace :test do
task :purge do
end
task :prepare do
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With