diff options
Diffstat (limited to 'crates/shirabe/tests/factory_test.rs')
| -rw-r--r-- | crates/shirabe/tests/factory_test.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/crates/shirabe/tests/factory_test.rs b/crates/shirabe/tests/factory_test.rs index b927d61..cfbbaee 100644 --- a/crates/shirabe/tests/factory_test.rs +++ b/crates/shirabe/tests/factory_test.rs @@ -3,21 +3,39 @@ use shirabe::factory::Factory; use shirabe::util::platform::Platform; +fn tear_down() { + Platform::clear_env("COMPOSER"); +} + +struct TearDown; + +impl Drop for TearDown { + fn drop(&mut self) { + tear_down(); + } +} + #[test] #[ignore = "mocks an IOInterface with a writeError expectation and a Config returning disable-tls=true; mocking is not available"] fn test_default_values_are_as_expected() { + let _tear_down = TearDown; + todo!() } #[test] -#[ignore = "depends on COMPOSER being unset, but sibling tests set it and the tearDown that clears it is not ported"] +#[ignore = "depends on COMPOSER being unset, but sibling tests set it and race it on the process-global env under parallel execution"] fn test_get_composer_json_path() { + let _tear_down = TearDown; + assert_eq!("./composer.json", Factory::get_composer_file().unwrap()); } #[test] -#[ignore = "mutates the global COMPOSER env and races the from_env case in parallel; the tearDown that clears it is not ported"] +#[ignore = "mutates the global COMPOSER env and races the from_env case under parallel execution"] fn test_get_composer_json_path_fails_if_dir() { + let _tear_down = TearDown; + let dir = env!("CARGO_MANIFEST_DIR"); Platform::put_env("COMPOSER", dir); let err = Factory::get_composer_file().unwrap_err(); @@ -32,6 +50,8 @@ fn test_get_composer_json_path_fails_if_dir() { #[test] fn test_get_composer_json_path_from_env() { + let _tear_down = TearDown; + Platform::put_env("COMPOSER", " foo.json "); assert_eq!("foo.json", Factory::get_composer_file().unwrap()); } |
