From 725191d3c3b8e01041246c11f378ef9badfa8c32 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 13 Jan 2017 00:22:16 -0800 Subject: [PATCH] Adjust spacing in handlebars_templates example. --- examples/handlebars_templates/src/tests.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/handlebars_templates/src/tests.rs b/examples/handlebars_templates/src/tests.rs index 89e2bfab..9e385afd 100644 --- a/examples/handlebars_templates/src/tests.rs +++ b/examples/handlebars_templates/src/tests.rs @@ -22,21 +22,19 @@ fn test_root() { let mut req = MockRequest::new(*method, "/"); run_test!(req, |mut response: Response| { assert_eq!(response.status(), Status::SeeOther); - assert!(response.body().is_none()); - + let location_headers: Vec<_> = response.header_values("Location").collect(); - assert_eq!(location_headers, vec!["/hello/Unknown"]); }); } - + // Check that other request methods are not accepted (and instead caught). for method in &[Post, Put, Delete, Options, Trace, Connect, Patch] { let mut req = MockRequest::new(*method, "/"); run_test!(req, |mut response: Response| { assert_eq!(response.status(), Status::NotFound); - + let mut map = ::std::collections::HashMap::new(); map.insert("path", "/"); let expected = Template::render("error/404", &map).to_string(); @@ -53,13 +51,13 @@ fn test_name() { let mut req = MockRequest::new(Get, "/hello/Jack"); run_test!(req, |mut response: Response| { assert_eq!(response.status(), Status::Ok); - + let context = super::TemplateContext { name: "Jack".to_string(), items: vec!["One", "Two", "Three"].iter().map(|s| s.to_string()).collect() }; - let expected = Template::render("index", &context).to_string(); + let expected = Template::render("index", &context).to_string(); let body_string = response.body().and_then(|body| body.into_string()); assert_eq!(body_string, Some(expected)); }); @@ -71,7 +69,7 @@ fn test_404() { let mut req = MockRequest::new(Get, "/hello/"); run_test!(req, |mut response: Response| { assert_eq!(response.status(), Status::NotFound); - + let mut map = ::std::collections::HashMap::new(); map.insert("path", "/hello/"); let expected = Template::render("error/404", &map).to_string();