> To ensure each test has a clean slate, we clear the database between each test. The proposed solution to manually nuke the database state seems crazy to me. Some alternatives: 1. Run the entire test in a transaction, do flushes and assert as normal. At the end, ROLLBACK instead of COMMIT and now you have a pristine database again. [1] 2. Setup pristine DB state once and then use `CREATE DATABASE ... WITH TEMPLATE .…
We wrote our own transaction library and have been shifting queries over to it/a saner ORM. https://github.com/shyp/pg-transactions.
I've never heard of database templates, I'll have to take a look.