Update test suite to drop database automatically when test is successfull
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
use crate::helpers::{TestApp, when_sending_an_email};
|
||||
use sqlx::PgPool;
|
||||
use wiremock::ResponseTemplate;
|
||||
|
||||
#[tokio::test]
|
||||
async fn unsubscribe_form_sends_a_valid_link_if_email_is_in_database() {
|
||||
let app = TestApp::spawn().await;
|
||||
#[sqlx::test]
|
||||
async fn unsubscribe_form_sends_a_valid_link_if_email_is_in_database(connection_pool: PgPool) {
|
||||
let app = TestApp::spawn(connection_pool).await;
|
||||
app.create_confirmed_subscriber().await;
|
||||
|
||||
when_sending_an_email()
|
||||
@@ -48,9 +49,9 @@ async fn unsubscribe_form_sends_a_valid_link_if_email_is_in_database() {
|
||||
assert!(html_fragment.contains("Good bye, friend"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn an_invalid_email_is_ignored() {
|
||||
let app = TestApp::spawn().await;
|
||||
#[sqlx::test]
|
||||
async fn an_invalid_email_is_ignored(connection_pool: PgPool) {
|
||||
let app = TestApp::spawn(connection_pool).await;
|
||||
app.create_confirmed_subscriber().await;
|
||||
|
||||
when_sending_an_email()
|
||||
|
||||
Reference in New Issue
Block a user