From c6f9a053c7328e6c782508114bd96aa569b5de7d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 28 Jan 2020 22:06:11 +0100 Subject: Move Rocket integration into askama_rocket crate --- testing/tests/rocket.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 testing/tests/rocket.rs (limited to 'testing/tests') diff --git a/testing/tests/rocket.rs b/testing/tests/rocket.rs deleted file mode 100644 index 3dbc357..0000000 --- a/testing/tests/rocket.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![cfg(feature = "with-rocket")] -#![feature(proc_macro_hygiene, decl_macro)] - -#[macro_use] -extern crate rocket; - -use askama::Template; - -use rocket::http::{ContentType, Status}; -use rocket::local::Client; - -#[derive(Template)] -#[template(path = "hello.html")] -struct HelloTemplate<'a> { - name: &'a str, -} - -#[get("/")] -fn hello() -> HelloTemplate<'static> { - HelloTemplate { name: "world" } -} - -#[test] -fn test_rocket() { - let rocket = rocket::ignite().mount("/", routes![hello]); - let client = Client::new(rocket).unwrap(); - let mut rsp = client.get("/").dispatch(); - assert_eq!(rsp.status(), Status::Ok); - assert_eq!(rsp.content_type(), Some(ContentType::HTML)); - assert_eq!(rsp.body_string().unwrap(), "Hello, world!"); -} -- cgit