Skip to content

Commit

Permalink
✅ test: disable GPG signing
Browse files Browse the repository at this point in the history
Ensures tests aren't influenced by local Git configuration.
  • Loading branch information
welpo committed Feb 4, 2024
1 parent 08197cb commit c736369
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/lint/test_commit_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,29 @@ fn setup_git_repo() -> TempDir {
let tmp_dir = TempDir::new().expect("Failed to create a temporary directory");
let repo_dir = tmp_dir.path();

// Initialize a git repository.
Command::new("git")
.args(["init"])
.current_dir(repo_dir)
.current_dir(&repo_dir)
.assert()
.success();

// Disable GPG signing (otherwise it can prompt for a passphrase during tests).
Command::new("git")
.args(["config", "commit.gpgsign", "false"])
.current_dir(&repo_dir)
.assert()
.success();

// Set the user name and email.
Command::new("git")
.args(["config", "user.name", "Test User"])
.current_dir(&repo_dir)
.assert()
.success();
Command::new("git")
.args(["config", "user.email", "test@example.com"])
.current_dir(&repo_dir)
.assert()
.success();

Expand Down

0 comments on commit c736369

Please sign in to comment.