cli icon indicating copy to clipboard operation
cli copied to clipboard

Generate DatabaseCleaner setup in new apps

Open timriley opened this issue 1 year ago • 1 comments

Cleaning the database between tests is essential functionality, and I don't think users should have to think about it.

We need a setup that:

  • Works with regular tests (transaction) as well as capybara-with-JS tests (truncation)
  • Works with multiple databases across slices

I think we should just generate the appropriate config into spec/support/database_cleaner.rb for the app database, and include some commented examples of how to make it work for additional databases.

Later (post-2.2) we can look at ways at codifying certain aspects of iterating over/interacting with the app's set of databases into hanami-db, and then find ways for that to be used to configure DatabaseCleaner.

timriley avatar Jul 09 '24 11:07 timriley