Skip to content

Commit

Permalink
test: set git user in test
Browse files Browse the repository at this point in the history
  • Loading branch information
altsem committed Feb 12, 2024
1 parent 554fa9c commit ddc9a40
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,13 @@ mod tests {
#[test]
fn fresh_init() {
let (ref mut terminal, ref mut state, dir) = setup(60, 20);
run(&dir, &["git", "init", "--initial-branch", "master"]);
update(terminal, state, &[key('g')]).unwrap();
insta::assert_snapshot!(redact_hashes(terminal, dir));
}

#[test]
fn new_file() {
let (ref mut terminal, ref mut state, dir) = setup(60, 20);
run(&dir, &["git", "init", "--initial-branch", "master"]);
run(&dir, &["touch", "new-file"]);
update(terminal, state, &[key('g')]).unwrap();
insta::assert_snapshot!(redact_hashes(terminal, dir));
Expand All @@ -428,7 +426,6 @@ mod tests {
#[test]
fn staged_file() {
let (ref mut terminal, ref mut state, dir) = setup(60, 20);
run(&dir, &["git", "init", "--initial-branch", "master"]);
run(&dir, &["touch", "new-file"]);
run(&dir, &["git", "add", "new-file"]);
update(terminal, state, &[key('g')]).unwrap();
Expand All @@ -438,8 +435,6 @@ mod tests {
#[test]
fn rebase_conflict() {
let (ref mut terminal, ref mut state, dir) = setup(60, 20);
run(&dir, &["git", "init", "--initial-branch", "master"]);

commit(&dir, "new-file", "hello");

run(&dir, &["git", "checkout", "-b", "other-branch"]);
Expand All @@ -458,8 +453,6 @@ mod tests {
#[test]
fn merge_conflict() {
let (ref mut terminal, ref mut state, dir) = setup(60, 20);
run(&dir, &["git", "init", "--initial-branch", "master"]);

commit(&dir, "new-file", "hello");

run(&dir, &["git", "checkout", "-b", "other-branch"]);
Expand All @@ -478,6 +471,10 @@ mod tests {
let terminal = Terminal::new(TestBackend::new(width, height)).unwrap();
let dir = TempDir::new().unwrap();

run(&dir, &["git", "init", "--initial-branch", "master"]);
run(&dir, &["git", "config", "user.email", "ci@example.com"]);
run(&dir, &["git", "config", "user.name", "CI"]);

let state = State::create(
crate::Config {
dir: dir.path().into(),
Expand Down

0 comments on commit ddc9a40

Please sign in to comment.