The accepted answer makes all tests slower (when it is not needed) by truncating after each of them.
Just add
config.use_transactional_fixtures = false
when using database_cleaner.
If you have both config.use_transactional_fixtures = true and DatabaseCleaner.strategy = :transaction , you must start the transaction inside another transaction and this is not allowed.
Filipe giusti
source share