diff --git a/test/install.Tests.ps1 b/test/install.Tests.ps1 index 1c93d39..f6d0316 100644 --- a/test/install.Tests.ps1 +++ b/test/install.Tests.ps1 @@ -1,4 +1,7 @@ BeforeAll { + $script:OriginalScoop = $env:SCOOP + $script:OriginalScoopGlobal = $env:SCOOP_GLOBAL + $env:SCOOP = Join-Path $TestDrive 'scoop' $env:SCOOP_GLOBAL = Join-Path $TestDrive 'scoop-global' @@ -7,6 +10,20 @@ BeforeAll { . ".\$sut" } +AfterAll { + if ($null -eq $script:OriginalScoop) { + Remove-Item Env:SCOOP -ErrorAction SilentlyContinue + } else { + $env:SCOOP = $script:OriginalScoop + } + + if ($null -eq $script:OriginalScoopGlobal) { + Remove-Item Env:SCOOP_GLOBAL -ErrorAction SilentlyContinue + } else { + $env:SCOOP_GLOBAL = $script:OriginalScoopGlobal + } +} + Describe 'Get-Downloader' -Tag 'Proxy' { Context 'No proxy given via script parameter' { It 'Returns WebClient without proxy' {