diff --git a/src/game.rs b/src/game.rs index 39dc6c0d..a4f3d4e2 100644 --- a/src/game.rs +++ b/src/game.rs @@ -904,7 +904,7 @@ mod tests { #[test] fn should_succeed_if_given_a_relative_game_path() { - let fixture = Fixture::new(GameType::TES3); + let fixture = Fixture::in_path(GameType::TES3, Path::new("target")); let game_path = make_relative(&fixture.game_path); assert!(game_path.is_relative()); @@ -972,7 +972,7 @@ mod tests { #[test] fn should_succeed_if_given_relative_paths() { - let fixture = Fixture::new(GameType::TES4); + let fixture = Fixture::in_path(GameType::TES3, Path::new("target")); let game_path = make_relative(&fixture.game_path); assert!(game_path.is_relative()); diff --git a/src/tests.rs b/src/tests.rs index d4fd2631..b7a4be8c 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -179,6 +179,20 @@ impl Fixture { .prefix("libloot-t\u{00E9}st-") .tempdir() .unwrap(); + + Self::with_tempdir(game_type, temp_dir) + } + + pub fn in_path(game_type: GameType, in_path: &Path) -> Fixture { + let temp_dir = tempfile::Builder::new() + .prefix("libloot-t\u{00E9}st-") + .tempdir_in(in_path) + .unwrap(); + + Self::with_tempdir(game_type, temp_dir) + } + + fn with_tempdir(game_type: GameType, temp_dir: TempDir) -> Fixture { let root_path = temp_dir.path(); let game_path = root_path.join("games/game"); let local_path = root_path.join("local/game");