rspec-style-guide icon indicating copy to clipboard operation
rspec-style-guide copied to clipboard

Mention the built-in alternative to DatabaseCleaner for Rails

Open pirj opened this issue 6 years ago • 0 comments
trafficstars

DatabaseCleaner was never meant to be used in Rails apps, and while still allowing the truncation and deletion strategies that some may find useful (I can't imagine in which cases though).

One of my motivations for writing this library was to have an easy way to turn on what Rails calls "transactional_fixtures" in my non-rails ActiveRecord projects.

Actually transactional_fixtures have nothing to do with fixtures, and have been recently renamed to transactional_tests to reflect what they are intended to be used for, wrap every example in a transaction and roll it back after example.

Originally found in https://anti-pattern.com/transactional-fixtures-in-rails

pirj avatar Nov 23 '18 12:11 pirj