mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-15 21:21:00 +00:00
Split into multiple files.
This commit is contained in:
parent
0344317f85
commit
beeeacdafb
3 changed files with 7 additions and 7 deletions
|
@ -1,9 +1,9 @@
|
|||
use crate::helpers;
|
||||
use crate::helpers::spawn_app;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn health_check_works() {
|
||||
// Arrange
|
||||
let app = helpers::spawn_app().await;
|
||||
let app = spawn_app().await;
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
// Act
|
||||
|
|
|
@ -53,7 +53,7 @@ pub async fn spawn_app() -> TestApp {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
// Create database
|
||||
let mut connection = PgConnection::connect_with(&config.without_db())
|
||||
.await
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::helpers;
|
||||
use crate::helpers::spawn_app;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn subscribe_returns_a_200_for_valid_form_data() {
|
||||
// Arrange
|
||||
let app = helpers::spawn_app().await;
|
||||
let app = spawn_app().await;
|
||||
let client = reqwest::Client::new();
|
||||
let body = "name=le%20guin&email=ursula_le_guin%40gmail.com";
|
||||
|
||||
|
@ -31,7 +31,7 @@ async fn subscribe_returns_a_200_for_valid_form_data() {
|
|||
#[actix_rt::test]
|
||||
async fn subscribe_returns_a_400_when_data_is_missing() {
|
||||
// Arrange
|
||||
let app = helpers::spawn_app().await;
|
||||
let app = spawn_app().await;
|
||||
let client = reqwest::Client::new();
|
||||
let test_cases = vec![
|
||||
("name=le%20guin", "missing the email"),
|
||||
|
@ -63,7 +63,7 @@ async fn subscribe_returns_a_400_when_data_is_missing() {
|
|||
#[actix_rt::test]
|
||||
async fn subscribe_returns_a_400_when_fields_are_present_but_invalid() {
|
||||
// Arrange
|
||||
let app = helpers::spawn_app().await;
|
||||
let app = spawn_app().await;
|
||||
let client = reqwest::Client::new();
|
||||
let test_cases = vec![
|
||||
("name=&email=ursula_le_guin%40gmail.com", "empty name"),
|
||||
|
|
Loading…
Reference in a new issue