4 ms·
I think one helpful thing is what rails calls transactional tests (https://guides.rubyonrails.org/testing.html#transactions https://guides.rubyonrails.org/testi
by TobiasBales 2y ago
I think one helpful thing is what rails calls transactional tests (https://guides.rubyonrails.org/testing.html#transactions https://guides.rubyonrails.org/testing.html#transactions). It basically does the database setup (migrations and seeds) and then executes the tests in a transaction that is rolled back at the end (and thus never committed). This helps with speed and also ensuring that tests don't have as much accidental codependence as they might otherwise.
If you use read replicas in production code this can become tricky though since the transactions don't commit they never become visible to the reader or even different connections to the same database