auric 0.1.4

CLI for the Ember-inspired Auric SPA framework
mod testsupport;

use assert_cmd::cargo_bin_cmd;
use std::path::Path;
use tempfile::TempDir;

#[tokio::test]
async fn can_generate_then_delete_a_model() {
    // Create a temp dir to hold a new app
    testsupport::require_acceptance_testing_enabled!();
    let tempdir = TempDir::new().expect("failed to create temp dir");
    let workspace = tempdir.path().join("my-app");
    std::fs::create_dir_all(&workspace).expect("Expected to create temp dir for workspace");

    // Run auric init
    let auric_cli_path = Path::new(env!("CARGO_MANIFEST_DIR"));
    let auric_workspace_path = auric_cli_path
        .join("../..")
        .canonicalize()
        .expect("Expected to get absolute workspace path");
    cargo_bin_cmd!("auric")
        .arg("init")
        .arg("--auricWorkspace")
        .arg(&auric_workspace_path)
        .current_dir(&workspace)
        .assert()
        .success();

    // Generate model
    const MODEL_NAME: &str = "foo";
    cargo_bin_cmd!("auric")
        .arg("generate")
        .arg("model")
        .arg(MODEL_NAME)
        .current_dir(&workspace)
        .assert()
        .success();

    // Delete model
    cargo_bin_cmd!("auric")
        .arg("delete")
        .arg("model")
        .arg(MODEL_NAME)
        .current_dir(&workspace)
        .assert()
        .success();
}