diff options
| author | Remo Senekowitsch <remo@buenzli.dev> | 2024-08-08 14:04:43 +0200 |
|---|---|---|
| committer | Remo Senekowitsch <remo@buenzli.dev> | 2024-08-08 14:08:06 +0200 |
| commit | 8b43d7925761edcd6ca8bacf382e82a05aa5c0e7 (patch) | |
| tree | eeb8e4094b672e42b5336e23bdc6d588b29c3dd9 /tests/integration_tests.rs | |
| parent | dc086c6bf1e678a1886e0a2bb78627fac076402d (diff) | |
Fix integration tests
Diffstat (limited to 'tests/integration_tests.rs')
| -rw-r--r-- | tests/integration_tests.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 3ab54f9..d821e20 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -155,28 +155,28 @@ fn hint() { #[test] fn init() { - let _ = fs::remove_dir_all("tests/rustlings"); + let test_dir = tempfile::TempDir::new().unwrap(); + let initialized_dir = test_dir.path().join("rustlings"); + let test_dir = test_dir.path().to_str().unwrap(); - Cmd::default().current_dir("tests").fail(); + Cmd::default().current_dir(test_dir).fail(); Cmd::default() - .current_dir("tests") + .current_dir(test_dir) .args(&["init"]) .success(); // Running `init` after a successful initialization. Cmd::default() - .current_dir("tests") + .current_dir(test_dir) .args(&["init"]) .output(PartialStderr("`cd rustlings`")) .fail(); // Running `init` in the initialized directory. Cmd::default() - .current_dir("tests/rustlings") + .current_dir(initialized_dir.to_str().unwrap()) .args(&["init"]) .output(PartialStderr("already initialized")) .fail(); - - fs::remove_dir_all("tests/rustlings").unwrap(); } |
