File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,13 +71,14 @@ mod tests {
7171 #[ test]
7272 fn read_config_with_path ( ) {
7373 let default_config = Config :: default ( ) ;
74- let path: PathBuf = "config.toml" . into ( ) ;
74+ let temp_dir = tempfile:: tempdir ( ) . expect ( "couldn't create temp dir" ) ;
75+ let config_file = temp_dir. path ( ) . join ( "config.toml" ) ;
7576 let serialized_config = toml:: to_string ( & default_config) . unwrap ( ) ;
76- std:: fs:: write ( path . clone ( ) , serialized_config) . unwrap ( ) ;
77+ std:: fs:: write ( & config_file , serialized_config) . unwrap ( ) ;
7778
78- let ( config_path, config) = read_config ( Some ( & path ) , None ) . unwrap ( ) ;
79+ let ( config_path, config) = read_config ( Some ( & config_file ) , None ) . unwrap ( ) ;
7980
80- assert_eq ! ( config_path. unwrap( ) , ConfigPath :: Cli ( path ) ) ;
81+ assert_eq ! ( config_path. unwrap( ) , ConfigPath :: Cli ( config_file ) ) ;
8182 assert_eq ! ( config. chain( ) , & NetworkChain :: Mainnet ) ;
8283 assert_eq ! ( config, default_config) ;
8384 }
You can’t perform that action at this time.
0 commit comments