Avoid copying templates in tests.

This commit is contained in:
Justus Winter 2019-03-13 12:22:06 +01:00
parent e01c13381d
commit 8e3c9714c0
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
3 changed files with 3 additions and 11 deletions

View File

@ -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"

View File

@ -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;

View File

@ -488,7 +488,6 @@ fn rocket_factory(rocket: rocket::Rocket) -> Result<rocket::Rocket> {
#[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()