diff --git a/.gitignore b/.gitignore index ea8c4bf..2a0038a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +.idea \ No newline at end of file diff --git a/src/rails_new.rs b/src/rails_new.rs index 1c452ac..025e933 100644 --- a/src/rails_new.rs +++ b/src/rails_new.rs @@ -3,7 +3,7 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] #[command(version, about, long_about = None, subcommand_negates_reqs = true)] pub struct Cli { - #[clap(trailing_var_arg = true, required = true)] + #[clap(trailing_var_arg = true)] /// arguments passed to `rails new` pub args: Vec, #[clap(long, short = 'u', default_value = "latest")] diff --git a/tests/cli.rs b/tests/cli.rs index 4339e52..103e4a3 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,17 +1,15 @@ use assert_cmd::prelude::*; -use predicates::prelude::*; use std::process::Command; #[test] fn requires_a_name() -> Result<(), Box> { - let mut cmd = Command::cargo_bin("rails-new")?; + let mut cmd = Command::cargo_bin("rails-new")?; - cmd.assert() - .failure() - .stderr(predicate::str::contains( - "the following required arguments were not provided:", - )) - .stderr(predicate::str::contains("...")); + cmd + .spawn() + .unwrap() + .wait_with_output() + .expect("rails new weblog --api"); - Ok(()) -} + Ok(()) +} \ No newline at end of file