2015-10-22 16:35:31 -07:00
|
|
|
Describe "Environment-Variables" {
|
2015-12-28 11:05:48 -08:00
|
|
|
$isWindows = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
|
|
|
|
|
|
2015-08-24 11:38:32 -07:00
|
|
|
It "Should have environment variables" {
|
2015-07-15 10:15:39 -07:00
|
|
|
Get-Item ENV: | Should Not BeNullOrEmpty
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-24 15:04:50 -07:00
|
|
|
It "Should have a nonempty PATH" {
|
|
|
|
|
$ENV:PATH | Should Not BeNullOrEmpty
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should contain /bin in the PATH" {
|
2015-12-28 11:05:48 -08:00
|
|
|
if ($isWindows)
|
2015-11-30 14:01:19 -08:00
|
|
|
{
|
2015-12-28 11:05:48 -08:00
|
|
|
$ENV:PATH | Should Match "C:"
|
2015-11-30 14:01:19 -08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-28 11:05:48 -08:00
|
|
|
$ENV:PATH | Should Match "/bin"
|
2015-11-30 14:01:19 -08:00
|
|
|
}
|
2015-08-24 15:04:50 -07:00
|
|
|
}
|
|
|
|
|
|
2015-11-05 10:11:38 -08:00
|
|
|
It "Should have the correct HOME" {
|
2015-12-28 11:05:48 -08:00
|
|
|
if ($isWindows)
|
2015-11-30 14:01:19 -08:00
|
|
|
{
|
2015-12-28 11:05:48 -08:00
|
|
|
$expected = "\Users\" + $ENV:USERNAME
|
2015-11-30 14:01:19 -08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-28 11:05:48 -08:00
|
|
|
$expected = /bin/bash -c "cd ~ && pwd"
|
2015-11-30 14:01:19 -08:00
|
|
|
}
|
2015-12-28 11:05:48 -08:00
|
|
|
$ENV:HOME | Should Be $expected
|
2015-08-24 11:38:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to set the environment variables" {
|
2015-08-25 10:15:21 -07:00
|
|
|
$expected = "this is a test environment variable"
|
|
|
|
|
{ $ENV:TESTENVIRONMENTVARIABLE = $expected } | Should Not Throw
|
2015-08-24 11:38:32 -07:00
|
|
|
|
|
|
|
|
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
|
2015-08-25 10:15:21 -07:00
|
|
|
$ENV:TESTENVIRONMENTVARIABLE | Should Be $expected
|
2015-07-16 15:52:42 -07:00
|
|
|
|
2015-07-15 10:15:39 -07:00
|
|
|
}
|
2015-07-16 15:52:42 -07:00
|
|
|
}
|