Update to Rust 2021
Also update dependencies and codebase to reflect 2021 standards and changes (tokio tests, etc)
This commit is contained in:
@@ -49,16 +49,16 @@ async fn spawn_app() -> TestApp {
|
||||
|
||||
pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
// Create database
|
||||
let mut connection = PgConnection::connect(&config.without_db())
|
||||
let mut connection = PgConnection::connect_with(&config.without_db())
|
||||
.await
|
||||
.expect("Failed to connect to Postgres");
|
||||
connection
|
||||
.execute(&*format!(r#"CREATE DATABASE "{}";"#, config.database_name).as_str())
|
||||
.execute(&*format!(r#"CREATE DATABASE "{}";"#, config.database_name))
|
||||
.await
|
||||
.expect("Failed to create database.");
|
||||
|
||||
// Migrate database
|
||||
let connection_pool = PgPool::connect(config.with_db())
|
||||
let connection_pool = PgPool::connect_with(config.with_db())
|
||||
.await
|
||||
.expect("Failed to connect to Postgres.");
|
||||
sqlx::migrate!("./migrations")
|
||||
@@ -69,7 +69,7 @@ pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
connection_pool
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
#[tokio::test]
|
||||
async fn health_check_works() {
|
||||
// Arrange
|
||||
let app = spawn_app().await;
|
||||
@@ -87,7 +87,7 @@ async fn health_check_works() {
|
||||
assert_eq!(Some(0), response.content_length());
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
#[tokio::test]
|
||||
async fn subscribe_returns_200_for_valid_form_data() {
|
||||
// Arrange
|
||||
let app = spawn_app().await;
|
||||
@@ -115,7 +115,7 @@ async fn subscribe_returns_200_for_valid_form_data() {
|
||||
assert_eq!(saved.name, "le guin");
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
#[tokio::test]
|
||||
async fn subscribe_returns_400_for_missing_form_data() {
|
||||
//Arrange
|
||||
let app = spawn_app().await;
|
||||
|
||||
Reference in New Issue
Block a user