-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Describe 'Testing Git Configuration Values' { | ||
BeforeAll { | ||
Function Get-GitConfigValue { | ||
<# | ||
.SYNOPSIS | ||
Gets a value from the global git config file. | ||
#> | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Mandatory)] | ||
[String]$Key, | ||
[Parameter()] | ||
[String]$GitConfigPath = "$HOME\.gitconfig" | ||
) | ||
|
||
$Cmd = "& git config --global --get $Key" | ||
Invoke-Expression -Command $Cmd | ||
} | ||
|
||
$Test_Email = Get-GitConfigValue -Key 'user.email' | ||
$Test_DefaultMain = Get-GitConfigValue -Key 'init.defaultBranch' | ||
$Test_SigningKey = Get-GitConfigValue -Key 'user.signingkey' | ||
$Test_GPGProgram = Get-GitConfigValue -Key 'gpg.program' | ||
$Test_CommitSigning = Get-GitConfigValue -Key 'commit.gpgSign' | ||
$Test_TagSigning = Get-GitConfigValue -Key 'tag.forceSignAnnotated' | ||
} | ||
|
||
It 'Checks that user.email is set' { | ||
$Test_Email | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It 'Checks that init.defaultBranch is set' { | ||
$Test_DefaultMain | Should -Be 'main' | ||
} | ||
|
||
It 'Checks that user.signingkey is set' { | ||
$Test_SigningKey | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It 'Checks that gpg.program is set' { | ||
$Test_GPGProgram | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It 'Checks that commit.gpgSign is set' { | ||
$Test_CommitSigning | Should -Be 'true' | ||
} | ||
|
||
It 'Checks that tag.forceSignAnnotated is set' { | ||
$Test_TagSigning | Should -Be 'true' | ||
} | ||
} |