diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-01-28 22:06:11 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-01-29 09:25:59 +0100 |
commit | c6f9a053c7328e6c782508114bd96aa569b5de7d (patch) | |
tree | 362ef1f8ef421eb5913fa2834c10f6743e1ca7e1 /testing | |
parent | b56c11639f9ea5ef1354a1e91ca98541a16bca9b (diff) | |
download | askama-c6f9a053c7328e6c782508114bd96aa569b5de7d.tar.gz askama-c6f9a053c7328e6c782508114bd96aa569b5de7d.tar.bz2 askama-c6f9a053c7328e6c782508114bd96aa569b5de7d.zip |
Move Rocket integration into askama_rocket crate
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Cargo.toml | 2 | ||||
-rw-r--r-- | testing/tests/rocket.rs | 31 |
2 files changed, 0 insertions, 33 deletions
diff --git a/testing/Cargo.toml b/testing/Cargo.toml index e7b9668..424dd73 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -9,14 +9,12 @@ edition = "2018" default = [] full = ["with-iron", "serde-json", "with-gotham"] serde-json = ["serde_json", "askama/serde-json"] -with-rocket = ["rocket", "askama/with-rocket"] with-iron = ["iron", "askama/with-iron"] with-gotham = ["gotham", "askama/with-gotham", "mime", "hyper"] [dependencies] askama = { path = "../askama", version = "*" } iron = { version = "0.6", optional = true } -rocket = { version = "0.4", default-features = false, optional = true } serde_json = { version = "1.0", optional = true } gotham = { version = "0.3", default-features = false, optional = true } mime = { version = "0.3", optional = true } 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!"); -} |