PowerShell/src/pester-tests/Test-Environment-Variables.Tests.ps1
2015-08-25 10:15:21 -07:00

35 lines
965 B
PowerShell

Describe "Test-Environment-Variables" {
It "Should have environment variables" {
Get-Item ENV: | Should Not BeNullOrEmpty
}
It "Should have a nonempty PATH" {
$ENV:PATH | Should Not BeNullOrEmpty
}
It "Should contain /bin in the PATH" {
$ENV:PATH | Should Match "/bin"
}
It "Should be able to access the members of the environment variable" {
$expected = /bin/bash -c "cd ~ && pwd"
(Get-Item ENV:HOME).Value | Should Be $expected
}
It "Should be able to set the environment variables" {
$expected = "this is a test environment variable"
{ $ENV:TESTENVIRONMENTVARIABLE = $expected } | Should Not Throw
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
$ENV:TESTENVIRONMENTVARIABLE | Should Be $expected
}
It "Should have the correct HOSTNAME" {
$expected = /bin/hostname
$ENV:HOSTNAME | Should Be $expected
}
}