Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure the DB is still "cleaned" even when transactions are not …
…used (#109) In some tests, we might ensure that a transaction has been rolled back (e.g. if an error occurred). Since currently we do not support transactions within other transactions, those tests use the `omit_database_transaction` flag which means the test does not get wrapped in a transaction. The problem is that these tests now leave data lying around after running. Our original plan to solve this was to find a way to still rollback in the app despite already running in a transaction. However Sequel does not support naming a transaction from what I can tell, and anyway there is no way to pass args to the transaction via the `DatabaseCleaner` gem. Going through some issues I found this issue: DatabaseCleaner/database_cleaner#652 Basically this person wants to read data from the DB in another app, but in only some tests. He took the approach of switching "strategy" to accomplish it. I am basically stealing the same idea since it seems to work and was quite trivial. The big downside is that those tests will probably take longer to run, luckily only 5 tests use this flag currently in echo, so this should not be too big of a problem.
- Loading branch information