Skip to main content

test_db

Function test_db 

Source
pub async fn test_db(models: ModelSet) -> Db
Expand description

A Db holding the tables of models and no rows.

The database is in-memory SQLite, fresh for each call, or the one TEST_DATABASE_URL names, whose driver the test crate enables through Toasty’s feature of the same name. Tests share that database, so each call’s tables carry a prefix of their own. An app whose migrations add what the models cannot state, such as a foreign key, tests on migrated_db instead.

§Panics

When the database refuses the connection or the tables.