Cleaning test databases faster
Published in
1 min readDec 12, 2016
We have been using database_cleaner for years and recently found out about database_rewinder which is a bit faster with projects that have a lot of tables. Unfortunately it didn't support Mongoid, ActiveRecord transactions and used monkey patches for ActiveRecord classes, so we decided to create a new gem.
Main Features
- No monkey patching — uses
ActiveSupport::Notifications
andMongo::Monitoring::Global
to catchINSERT
statements - Fast
:deletion
strategy that cleans only tables/collections whereINSERT
statements were performed - Faster
disable_referential_integrity
for PostgreSQL - Executes multiple
DELETE
statements as one query with ActiveRecord - Supports only one database for each ORM