mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-30 21:32:02 +00:00
Sync testing exmaple with guide.
This commit is contained in:
parent
b0f1263c0e
commit
2cf7e2c6cd
@ -16,6 +16,7 @@ fn main() {
|
||||
mod test {
|
||||
use super::rocket;
|
||||
use rocket::testing::MockRequest;
|
||||
use rocket::http::Status;
|
||||
use rocket::http::Method::*;
|
||||
|
||||
#[test]
|
||||
@ -23,6 +24,7 @@ mod test {
|
||||
let rocket = rocket::ignite().mount("/", routes![super::hello]);
|
||||
let mut req = MockRequest::new(Get, "/");
|
||||
let mut response = req.dispatch_with(&rocket);
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
|
||||
let body_string = response.body().and_then(|b| b.into_string());
|
||||
assert_eq!(body_string, Some("Hello, world!".to_string()));
|
||||
|
Loading…
Reference in New Issue
Block a user