Skip to content

Commit

Permalink
tests/util/test_app: Remove obsolete db() fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Oct 21, 2024
1 parent a614dbf commit dbae8d9
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/tests/util/test_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,6 @@ impl TestApp {
Self::init().with_git_index().with_job_runner()
}

/// Obtain the database connection and pass it to the closure
///
/// Within each test, the connection pool only has 1 connection so it is necessary to drop the
/// connection before making any API calls. Once the closure returns, the connection is
/// dropped, ensuring it is returned to the pool and available for any future API calls.
pub fn db<T, F: FnOnce(&mut PgConnection) -> T>(&self, f: F) -> T {
f(&mut self.db_conn())
}

/// Obtain a database connection.
pub fn db_conn(&self) -> PooledConnection<ConnectionManager<PgConnection>> {
self.0.test_database.connect()
Expand Down

0 comments on commit dbae8d9

Please sign in to comment.