summaryrefslogtreecommitdiffstats
path: root/tests/no_repo_error.rs
blob: f12e250db9e0322959bf633f6f6cecd000938783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use assert_cmd::Command;

#[test]
fn no_repo_errors() {
    let temp_dir = tempfile::Builder::new()
        .prefix("cargo-changelog")
        .tempdir()
        .unwrap();

    Command::cargo_bin("cargo-changelog")
        .unwrap()
        .args(["generate-changelog"]) // we need some subcommand, otherwise nothing happens
        .current_dir(&temp_dir)
        .assert()
        .failure();
}

#[test]
fn no_repo_errors_with_no_repo_error_message() {
    let temp_dir = tempfile::Builder::new()
        .prefix("cargo-changelog")
        .tempdir()
        .unwrap();

    Command::cargo_bin("cargo-changelog")
        .unwrap()
        .args(["generate-changelog"]) // we need some subcommand, otherwise nothing happens
        .current_dir(&temp_dir)
        .assert()
        .stderr(predicates::str::contains("could not find repository"));
}