Skip to content
This repository has been archived by the owner on Dec 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #56 from dsprenkels/ignore_status
Browse files Browse the repository at this point in the history
Add Assert::ignore_status() for ignoring the command status
  • Loading branch information
epage authored Oct 17, 2017
2 parents d1aa8ec + 95be0f1 commit a01f933
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,30 @@ impl Assert {
self
}

/// Do not care whether the command exits successfully or if it fails.
///
/// This function removes any assertions that were already set, including
/// any expected exit code that was set with [`fails_with`].
///
/// # Examples
///
/// ```rust
/// extern crate assert_cli;
///
/// assert_cli::Assert::command(&["cat", "non-existing-file"])
/// .ignore_status()
/// .and()
/// .stderr().is("cat: non-existing-file: No such file or directory")
/// .unwrap();
/// ```
///
/// [`fails_with`]: #method.fails_with
pub fn ignore_status(mut self) -> Self {
self.expect_exit_code = None;
self.expect_success = None;
self
}

/// Create an assertion for stdout's contents
///
/// # Examples
Expand Down

0 comments on commit a01f933

Please sign in to comment.