diff options
Diffstat (limited to 'testing/tests')
-rw-r--r-- | testing/tests/rocket.rs | 31 |
1 files changed, 0 insertions, 31 deletions
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!"); -} |