diff --git a/src/rails_new.rs b/src/rails_new.rs index b0ca823..a7469f1 100644 --- a/src/rails_new.rs +++ b/src/rails_new.rs @@ -12,21 +12,27 @@ pub struct Cli { pub rails_version: String, } -#[test] -fn verify_cli() { - use clap::CommandFactory; - Cli::command().debug_assert() -} +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn verify_cli() { + use clap::CommandFactory; + + Cli::command().debug_assert() + } -#[test] -fn arguments_are_directed_to_rails_new() -> Result<(), Box<dyn std::error::Error>> { - use clap::CommandFactory; + #[test] + fn arguments_are_directed_to_rails_new() -> Result<(), Box<dyn std::error::Error>> { + use clap::CommandFactory; - let m = Cli::command().get_matches_from(vec!["rails-new", "my_app", "--main"]); + let m = Cli::command().get_matches_from(vec!["rails-new", "my_app", "--main"]); - let trail: Vec<_> = m.get_many::<String>("args").unwrap().collect(); + let trail: Vec<_> = m.get_many::<String>("args").unwrap().collect(); - assert_eq!(trail, &["my_app", "--main"]); + assert_eq!(trail, &["my_app", "--main"]); - Ok(()) + Ok(()) + } }