mod common;
use predicates::{prelude::predicate, str::PredicateStrExt};
use slumber_config::Config;
#[test]
fn test_print_config() {
let (mut command, _) = common::slumber();
command.args(["config"]);
let expected = serde_yaml::to_string(&Config::default()).unwrap();
command.assert().success().stdout(predicate::eq(expected));
}
#[test]
fn test_print_path() {
let (mut command, data_dir) = common::slumber();
command.args(["config", "--path"]);
let expected = data_dir.join("config.yml").display().to_string();
command
.assert()
.success()
.stdout(predicate::eq(expected).trim());
}
#[test]
fn test_edit() {
let (mut command, _) = common::slumber();
command.env("EDITOR", "cat").args(["config", "--edit"]);
let expected =
String::from_utf8(Config::default_content().into_bytes()).unwrap();
command.assert().success().stdout(predicate::eq(expected));
}