Last active
December 28, 2016 02:44
-
-
Save sethlopezme/19315dcf21a48d65684f849ff191db7c to your computer and use it in GitHub Desktop.
config/tests/common/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(plugin)] | |
#![plugin(rocket_codegen)] | |
// use rocket::config; | |
use rocket::http::Method; | |
use rocket::testing::MockRequest; | |
extern crate config as lib; | |
#[test] | |
pub fn test_config(environment: &str) { | |
// set the environment for rocket | |
std::env::set_var("ROCKET_ENV", environment); | |
rocket::ignite().mount("/hello", routes![lib::hello]); | |
let mut request = MockRequest::new(Method::Get, "/hello"); | |
let mut response = request.dispatch_with(&rocket); | |
assert_eq!(response.body().and_then(|b| b.into_string()), | |
Some("Hello, world!".to_string())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment