diff --git a/Boxstarter.Chocolatey/Chocolatey.ps1 b/Boxstarter.Chocolatey/Chocolatey.ps1 index bd032c43..3a46e4dc 100644 --- a/Boxstarter.Chocolatey/Chocolatey.ps1 +++ b/Boxstarter.Chocolatey/Chocolatey.ps1 @@ -112,7 +112,7 @@ Intercepts Chocolatey call to check for reboots $winFeature=$true } } - if((Test-PendingReboot) -and $Boxstarter.RebootOk -or $Boxstarter.IsRebooting) {return Invoke-Reboot} + if(((Test-PendingReboot) -or $Boxstarter.IsRebooting) -and $Boxstarter.RebootOk) {return Invoke-Reboot} $session=Start-TimedSection "Calling Chocolatey to install $packageName. This may take several minutes to complete..." try { if($winFeature -eq $true -and (Get-IsRemote)){ diff --git a/tests/Chocolatey/Chocolatey.tests.ps1 b/tests/Chocolatey/Chocolatey.tests.ps1 index ce89d735..addb3d0d 100644 --- a/tests/Chocolatey/Chocolatey.tests.ps1 +++ b/tests/Chocolatey/Chocolatey.tests.ps1 @@ -43,7 +43,8 @@ Describe "Getting-Chocolatey" { } it "will not get Chocolatey" { Assert-MockCalled Call-Chocolatey -times 0 - } + } + $Boxstarter.IsRebooting=$false } Context "When a reboot is pending but reboots are not OK" { @@ -199,6 +200,7 @@ Describe "Getting-Chocolatey" { Mock Test-PendingReboot {return $false} Mock Invoke-Reboot Mock Call-Chocolatey {$global:LASTEXITCODE=1} + $Boxstarter.IsRebooting=$false $error = Chocolatey Install pkg 2>&1 @@ -206,8 +208,4 @@ Describe "Getting-Chocolatey" { $error| should match "Chocolatey reported an unsuccessful exit code of 1" } } - - #Not sure why I need to do this but pester test drive cleanup - #does not properly cleanup without it - #Remove-Item $TestDrive -recurse -force } \ No newline at end of file