-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2057 from seanpoulter/init-skip
fix(cli): init --force skips confirmation prompts
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::cli::cmd::mdbook_cmd; | ||
use crate::dummy_book::DummyBook; | ||
|
||
use mdbook::config::Config; | ||
|
||
/// Run `mdbook init` with `--force` to skip the confirmation prompts | ||
#[test] | ||
fn base_mdbook_init_can_skip_confirmation_prompts() { | ||
let temp = DummyBook::new().build().unwrap(); | ||
|
||
// doesn't exist before | ||
assert!(!temp.path().join("book").exists()); | ||
|
||
let mut cmd = mdbook_cmd(); | ||
cmd.args(["init", "--force"]).current_dir(temp.path()); | ||
cmd.assert() | ||
.success() | ||
.stdout(predicates::str::contains("\nAll done, no errors...\n")); | ||
|
||
let config = Config::from_disk(temp.path().join("book.toml")).unwrap(); | ||
assert_eq!(config.book.title, None); | ||
|
||
assert!(!temp.path().join(".gitignore").exists()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod build; | ||
mod cmd; | ||
mod init; | ||
mod test; |