From 8e3c9714c027f76aa770733288e417f386acdbd4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 13 Mar 2019 12:22:06 +0100 Subject: [PATCH] Avoid copying templates in tests. --- Cargo.toml | 1 - src/main.rs | 2 -- src/web/mod.rs | 11 +++-------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7044001..1157cd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ url = "1.6" lettre_email = "0.8" handlebars = "1.1.0" num_cpus = "1.0" -fs_extra = "1.0" [dependencies.lettre] version = "0.8" diff --git a/src/main.rs b/src/main.rs index f8a5cc4..5fec070 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,8 +24,6 @@ extern crate lettre; extern crate lettre_email; extern crate tempfile; -#[cfg(test)] -extern crate fs_extra; #[cfg(test)] extern crate regex; diff --git a/src/web/mod.rs b/src/web/mod.rs index e0b0606..25cd05b 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -488,7 +488,6 @@ fn rocket_factory(rocket: rocket::Rocket) -> Result { #[cfg(test)] pub mod tests { - use fs_extra; use regex; use std::fs; use std::path::Path; @@ -519,18 +518,14 @@ pub mod tests { use rocket::config::{Config, Environment}; let root = tempdir()?; - fs_extra::copy_items(&vec!["dist/templates"], &root, - &fs_extra::dir::CopyOptions::new())?; let filemail = root.path().join("filemail"); ::std::fs::create_dir_all(&filemail)?; let config = Config::build(Environment::Staging) .root(root.path().to_path_buf()) - .extra( - "template_dir", - root.path().join("templates").to_str() - .ok_or(failure::err_msg("Template path invalid"))?, - ) + .extra("template_dir", + ::std::env::current_dir().unwrap().join("dist/templates") + .to_str().unwrap()) .extra( "state_dir", root.path().to_str()