summaryrefslogtreecommitdiffstats
path: root/src/modules/git_branch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/git_branch.rs')
-rw-r--r--src/modules/git_branch.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/git_branch.rs b/src/modules/git_branch.rs
index e6cadb810..9e767ec7d 100644
--- a/src/modules/git_branch.rs
+++ b/src/modules/git_branch.rs
@@ -121,9 +121,9 @@ fn get_first_grapheme(text: &str) -> &str {
mod tests {
use ansi_term::Color;
use std::io;
- use std::process::Command;
use crate::test::{fixture_repo, FixtureProvider, ModuleRenderer};
+ use crate::utils::create_command;
#[test]
fn show_nothing_on_empty_dir() -> io::Result<()> {
@@ -270,12 +270,12 @@ mod tests {
fn test_works_with_unborn_default_branch() -> io::Result<()> {
let repo_dir = tempfile::tempdir()?;
- Command::new("git")
+ create_command("git")?
.args(&["init"])
.current_dir(&repo_dir)
.output()?;
- Command::new("git")
+ create_command("git")?
.args(&["symbolic-ref", "HEAD", "refs/heads/main"])
.current_dir(&repo_dir)
.output()?;
@@ -297,7 +297,7 @@ mod tests {
fn test_render_branch_only_attached_on_branch() -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
- Command::new("git")
+ create_command("git")?
.args(&["checkout", "-b", "test_branch"])
.current_dir(repo_dir.path())
.output()?;
@@ -325,7 +325,7 @@ mod tests {
fn test_render_branch_only_attached_on_detached() -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
- Command::new("git")
+ create_command("git")?
.args(&["checkout", "@~1"])
.current_dir(&repo_dir.path())
.output()?;
@@ -348,12 +348,12 @@ mod tests {
fn test_works_in_bare_repo() -> io::Result<()> {
let repo_dir = tempfile::tempdir()?;
- Command::new("git")
+ create_command("git")?
.args(&["init", "--bare"])
.current_dir(&repo_dir)
.output()?;
- Command::new("git")
+ create_command("git")?
.args(&["symbolic-ref", "HEAD", "refs/heads/main"])
.current_dir(&repo_dir)
.output()?;
@@ -379,7 +379,7 @@ mod tests {
// fn test_git_dir_env_variable() -> io::Result<()> {let repo_dir =
// tempfile::tempdir()?;
- // Command::new("git")
+ // create_command("git")?
// .args(&["init"])
// .current_dir(&repo_dir)
// .output()?;
@@ -424,7 +424,7 @@ mod tests {
) -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
- Command::new("git")
+ create_command("git")?
.args(&["checkout", "-b", branch_name])
.current_dir(repo_dir.path())
.output()?;
@@ -463,7 +463,7 @@ mod tests {
) -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
- Command::new("git")
+ create_command("git")?
.args(&["checkout", "-b", branch_name])
.current_dir(repo_dir.path())
.output()?;