roberts1000 / rspec_n

A ruby gem that runs RSpec N times.
MIT License
49 stars 5 forks source link

Use db:schema:load to prepare the test database #118

Closed roberts1000 closed 6 months ago

roberts1000 commented 6 months ago

Based on the discussion in https://github.com/roberts1000/rspec_n/issues/104, use db:schema:load to rebuild/prepare the database, before each run, instead of db:migrate. Using db:schema:load is faster and helps projects that have old migrations, which may no longer run properly.

Note: This is potentially a breaking change for projects that haven't kept their schema.rb or structure.sql update. Projects will either need to update their schema.rb or structure.sql, or use the -c option to invoke rspec_n using the old migration approach, like this:

rspec_n 10 -c DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=test bundle exec rake db:drop db:create db:migrate && bundle exec rspec`.