Phoenix how to disabled Ecto sanbox in test- Test without sandbox

At the risk of necromancing this thread once more:

you can do Ecto.Adapters.SQL.Sandbox.start_owner!(Repo, sandbox: false) in your DataCase setup

I sometimes use this to peek into the database state when working on a specific test case.

This is especially helpful when testing insert logic, e.g. for bulk upserts. Obviously, you will need to reset the tables manually when you are done to not interfere with other tests.

1 Like