aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2019-03-20 20:23:06 +0100
committerHarald Eilertsen <haraldei@anduin.net>2019-03-20 20:24:44 +0100
commit9c3a341e79581541fc39ceddeec28daae7dc28cf (patch)
treea283c57d8917fcfd9fbed06c730b64b8c79e4504 /tests
parentcd6eba8b2b70404e93d9d4b0832faa7c9f00d217 (diff)
downloadramaskrik-social-9c3a341e79581541fc39ceddeec28daae7dc28cf.tar.gz
ramaskrik-social-9c3a341e79581541fc39ceddeec28daae7dc28cf.tar.bz2
ramaskrik-social-9c3a341e79581541fc39ceddeec28daae7dc28cf.zip
Pass database url into build_rocket helper function.
Diffstat (limited to 'tests')
-rw-r--r--tests/room_tests.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/room_tests.rs b/tests/room_tests.rs
index c91519d..292954a 100644
--- a/tests/room_tests.rs
+++ b/tests/room_tests.rs
@@ -21,7 +21,10 @@ use rocket::http::ContentType;
#[test]
fn getting_rooms_from_api() {
- let server = ramaskrik::build_rocket().unwrap();
+ let db_url = dotenv::var("DATABASE_URL")
+ .map_err(|_| "No database! Set DATABASE_URL env var and try again.").unwrap();
+
+ let server = ramaskrik::build_rocket(&db_url).unwrap();
let client = rocket::local::Client::new(server).unwrap();
let mut response = client.get("/rooms").dispatch();
assert_eq!(response.content_type(), Some(ContentType::JSON));