@@ -105,7 +105,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
105105 }
106106 }
107107
108- Context - Name ' When creating a repository with all possible settings' - Fixture {
108+ Context - Name ' When creating a public repository with all possible settings' - Fixture {
109109 BeforeAll - ScriptBlock {
110110 $repoName = ([Guid ]::NewGuid().Guid)
111111 $testGitIgnoreTemplate = (Get-GitHubGitIgnore )[0 ]
@@ -122,6 +122,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
122122 DisallowSquashMerge = $true
123123 DisallowMergeCommit = $true
124124 DisallowRebaseMerge = $false
125+ AllowAutoMerge = $true
125126 DeleteBranchOnMerge = $true
126127 GitIgnoreTemplate = $testGitIgnoreTemplate
127128 LicenseTemplate = $testLicenseTemplate
@@ -146,6 +147,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
146147 $repo.allow_squash_merge | Should - BeFalse
147148 $repo.allow_merge_commit | Should - BeFalse
148149 $repo.allow_rebase_merge | Should - BeTrue
150+ $repo.allow_auto_merge | Should - BeTrue
149151 $repo.delete_branch_on_merge | Should - BeTrue
150152 $repo.is_template | Should - BeTrue
151153 }
@@ -166,14 +168,15 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
166168 }
167169 }
168170
169- Context - Name ' When creating a repository with alternative Merge settings' - Fixture {
171+ Context - Name ' When creating a public repository with alternative Merge settings' - Fixture {
170172 BeforeAll - ScriptBlock {
171173 $repoName = ([Guid ]::NewGuid().Guid)
172174 $newGitHubRepositoryParms = @ {
173175 RepositoryName = $repoName
174176 DisallowSquashMerge = $true
175177 DisallowMergeCommit = $false
176178 DisallowRebaseMerge = $true
179+ AllowAutoMerge = $false
177180 }
178181 $repo = New-GitHubRepository @newGitHubRepositoryParms
179182 }
@@ -187,6 +190,7 @@ Describe 'GitHubRepositories\New-GitHubRepository' {
187190 $repo.allow_squash_merge | Should - BeFalse
188191 $repo.allow_merge_commit | Should - BeTrue
189192 $repo.allow_rebase_merge | Should - BeFalse
193+ $repo.allow_auto_merge | Should - BeFalse
190194 }
191195
192196 AfterAll - ScriptBlock {
@@ -719,6 +723,48 @@ Describe 'GitHubRepositories\Set-GitHubRepository' {
719723 $repo = New-GitHubRepository - RepositoryName $repoName
720724 }
721725
726+ Context - Name ' When updating a public repository with auto-merge set to true' {
727+ BeforeAll - ScriptBlock {
728+ $updateGithubRepositoryParms = @ {
729+ OwnerName = $repo.owner.login
730+ RepositoryName = $repoName
731+ AllowAutoMerge = $true
732+ }
733+
734+ $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms - PassThru
735+ }
736+
737+ It ' Should return an object of the correct type' {
738+ $updatedRepo | Should - BeOfType PSCustomObject
739+ }
740+
741+ It ' Should return the correct properties' {
742+ $updatedRepo.name | Should - Be $repoName
743+ $updatedRepo.allow_auto_merge | Should - BeTrue
744+ }
745+ }
746+
747+ Context - Name ' When updating a public repository with auto-merge set to false' {
748+ BeforeAll - ScriptBlock {
749+ $updateGithubRepositoryParms = @ {
750+ OwnerName = $repo.owner.login
751+ RepositoryName = $repoName
752+ AllowAutoMerge = $false
753+ }
754+
755+ $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms - PassThru
756+ }
757+
758+ It ' Should return an object of the correct type' {
759+ $updatedRepo | Should - BeOfType PSCustomObject
760+ }
761+
762+ It ' Should return the correct properties' {
763+ $updatedRepo.name | Should - Be $repoName
764+ $updatedRepo.allow_auto_merge | Should - BeFalse
765+ }
766+ }
767+
722768 Context - Name ' When updating a repository with all possible settings' {
723769 BeforeAll - ScriptBlock {
724770 $updateGithubRepositoryParms = @ {
0 commit comments