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

Commit 4de8e96

Browse files
author
Daan Sprenkels
committed
Implement Assert::ignore_status
Fixes #23
1 parent d1aa8ec commit 4de8e96

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/assert.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,25 @@ impl Assert {
238238
self
239239
}
240240

241+
/// Do not care whether the command exits successfully or if it fails.
242+
///
243+
/// # Examples
244+
///
245+
/// ```rust
246+
/// extern crate assert_cli;
247+
///
248+
/// assert_cli::Assert::command(&["cat", "non-existing-file"])
249+
/// .ignore_status()
250+
/// .and()
251+
/// .stderr().is("cat: non-existing-file: No such file or directory")
252+
/// .unwrap();
253+
/// ```
254+
pub fn ignore_status(mut self) -> Self {
255+
self.expect_exit_code = None;
256+
self.expect_success = None;
257+
self
258+
}
259+
241260
/// Create an assertion for stdout's contents
242261
///
243262
/// # Examples

0 commit comments

Comments
 (0)