Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Rails Tests without Dropping Test Database

Just wondering if there's a way to run Rails tests without dropping the database. I'm currently only executing unit tests and am using the following rake command to do so: rake test:units.

Thanks for the help in advance!

Just in case this is relevant:

  • Rails 3
  • Ruby 1.8.7 (MRI)
  • Oracle 11g Database
    • activerecord-oracle_enhanced-adapter
like image 671
John Avatar asked Sep 22 '10 14:09

John


1 Answers

In Rails 5 (and possibly earlier versions), just comment-out the following line in spec/rails_helper.rb:

 ActiveRecord::Migration.maintain_test_schema!

This will prevent rake test or rspec from attempting to drop your test DB. You'll need to run migrations manually as well.

like image 128
Jim Stewart Avatar answered Sep 23 '22 00:09

Jim Stewart