Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Created January 2, 2012 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ferventcoder/1551089 to your computer and use it in GitHub Desktop.
Save ferventcoder/1551089 to your computer and use it in GitHub Desktop.
Pester - Script variables should reset for every describe
Describe "When installing packages from a packages.config manifest" {
$script:chocolatey_nuget_was_called = $false
$script:chocolatey_rubygem_was_called = $false
$script:chocolatey_webpi_was_called = $false
$script:packageName = ''
$script:version = ''
# content here
}
Describe "When installing packages from a packages.config manifest that doesn't exist" {
$script:chocolatey_nuget_was_called = $false
$script:chocolatey_rubygem_was_called = $false
$script:chocolatey_webpi_was_called = $false
$script:packageName = ''
$script:version = ''
# content here
}
#all script variables automatically reset
#$script:chocolatey_nuget_was_called = $false
#$script:chocolatey_rubygem_was_called = $false
#$script:chocolatey_webpi_was_called = $false
#$script:packageName = ''
#$script:version = ''
Describe "When installing packages from a packages.config manifest" {
# content here
}
Describe "When installing packages from a packages.config manifest that doesn't exist" {
# content here
}
function Initialize-Variables {
$script:chocolatey_nuget_was_called = $false
$script:chocolatey_rubygem_was_called = $false
$script:chocolatey_webpi_was_called = $false
$script:packageName = ''
$script:version = ''
}
Describe "When installing packages from a packages.config manifest" {
Initialize-Variables
# content here
}
Describe "When installing packages from a packages.config manifest that doesn't exist" {
Initialize-Variables
# content here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment