Replace std::env::temp_dir with tempdir in tests (#8103)

* std::env::temp_dir -> tempdir in test context

* fix lifetime issue so tempdir removes tmpfiles
This commit is contained in:
Niklas Adolfsson
2018-03-14 12:26:20 +01:00
committed by Marek Kotewicz
parent 7e948a088f
commit 23fc5517b5
15 changed files with 65 additions and 21 deletions

View File

@@ -832,11 +832,13 @@ mod tests {
use state::State;
use tests::helpers::get_temp_state_db;
use views::BlockView;
use tempdir::TempDir;
// https://github.com/paritytech/parity/issues/1840
#[test]
fn test_load_empty() {
assert!(Spec::load(&::std::env::temp_dir(), &[] as &[u8]).is_err());
let tempdir = TempDir::new("").unwrap();
assert!(Spec::load(&tempdir.path(), &[] as &[u8]).is_err());
}
#[test]