use assert_cmd::prelude::*; use predicates::prelude::*; use std::process::Command; mod common; #[test] fn load_empty() -> Result<(), Box> { // Create a temporary project let root_dir = common::create_project("load-empty")?; let folder = root_dir.path(); // Load the project let mut cmd = Command::cargo_bin("orcs")?; cmd.arg("load").arg("-p").arg(&folder); cmd.assert() .success() .stdout(predicate::str::contains("load-empty")); Ok(()) } #[test] fn load_with_service() -> Result<(), Box> { // Create a temporary project let root_dir = common::create_project("load-with-service")?; let folder = root_dir.path(); common::create_service(folder, "hello-world")?; let mut cmd = Command::cargo_bin("orcs")?; cmd.arg("load").arg("-p").arg(&folder); cmd.assert() .success() .stdout(predicate::str::contains("load-with-service")) .stdout(predicate::str::contains("hello-world")); Ok(()) } #[test] fn load_with_recipe() -> Result<(), Box> { // Create a temporary project let root_dir = common::create_project("load-with-recipe")?; let folder = root_dir.path(); common::create_recipe(folder, "hello-recipe")?; let mut cmd = Command::cargo_bin("orcs")?; cmd.arg("load").arg("-p").arg(&folder); cmd.assert() .success() .stdout(predicate::str::contains("load-with-recipe")) // Load doesn't contain recipes .stdout(predicate::str::contains("hello-world").count(0)); Ok(()) }