From f66a16c34c9054910c470644ca5327bc2d3a1e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Mon, 25 Mar 2019 23:10:36 +0000 Subject: [PATCH] added testing module to the controllers --- src/controllers.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/controllers.rs b/src/controllers.rs index b0b7589..24bf1f3 100644 --- a/src/controllers.rs +++ b/src/controllers.rs @@ -3,3 +3,15 @@ use actix_web::{HttpRequest, Responder}; pub fn index(_req: &HttpRequest) -> impl Responder { "Hello world!" } + +#[cfg(test)] +mod tests { + use super::*; + use actix_web::{http, test}; + + #[test] + fn test_index() { + let resp = test::TestRequest::default().run(&index).unwrap(); + assert_eq!(resp.status(), http::StatusCode::OK); + } +}