aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/iron.rs
blob: 6f8868f4ba0d67432f6c210885374d5e0298033b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[macro_use]
extern crate askama;
extern crate iron;

use askama::Template;
use iron::{status, Response};

#[derive(Template)]
#[template(path = "hello.html")]
struct HelloTemplate<'a> {
    name: &'a str,
}

#[test]
fn test_iron() {
    let rsp = Response::with((status::Ok, HelloTemplate { name: "world" }));
    let mut buf = Vec::new();
    let _ = rsp.body.unwrap().write_body(&mut buf);
    assert_eq!(buf, b"Hello, world!");
}