Macro trillium_testing::assert_body_contains[][src]

macro_rules! assert_body_contains {
    ($conn : expr, $pattern : expr) => { ... };
}
Expand description

asserts that the response body matches the specified pattern, using str::contains

use trillium_testing::prelude::*;
let handler = "there's a needle in this haystack";
assert_body_contains!(get("/").on(&handler), "needle");

let mut conn = get("/").on(&handler);
let body = assert_body_contains!(&mut conn, "needle");
assert!(body.contains("haystack"));
use trillium_testing::prelude::*;
assert_body_contains!(get("/").on(&()), "what body?");
use trillium_testing::prelude::*;
assert_body_contains!(get("/").on(&"just a haystack"), "needle");