2016-03-04 23:48:30 +01:00
|
|
|
Describe "Environment-Variables" {
|
2015-12-28 20:05:48 +01:00
|
|
|
|
2015-08-24 20:38:32 +02:00
|
|
|
It "Should have environment variables" {
|
2016-03-04 23:52:27 +01:00
|
|
|
Get-Item ENV: | Should Not BeNullOrEmpty
|
2015-07-15 19:15:39 +02:00
|
|
|
}
|
|
|
|
|
2015-08-25 00:04:50 +02:00
|
|
|
It "Should have a nonempty PATH" {
|
2016-03-04 23:52:27 +01:00
|
|
|
$ENV:PATH | Should Not BeNullOrEmpty
|
2015-08-25 00:04:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should contain /bin in the PATH" {
|
2016-03-04 23:52:27 +01:00
|
|
|
if ($IsWindows)
|
|
|
|
{
|
|
|
|
$ENV:PATH | Should Match "C:"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ENV:PATH | Should Match "/bin"
|
|
|
|
}
|
2015-08-25 00:04:50 +02:00
|
|
|
}
|
|
|
|
|
2015-11-05 19:11:38 +01:00
|
|
|
It "Should have the correct HOME" {
|
2016-03-04 23:52:27 +01:00
|
|
|
if ($IsWindows)
|
|
|
|
{
|
|
|
|
$expected = "\Users"
|
|
|
|
Split-Path $ENV:HOMEPATH -Parent | Should Be $expected
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$expected = /bin/bash -c "cd ~ && pwd"
|
|
|
|
$ENV:HOME | Should Be $expected
|
|
|
|
}
|
2015-08-24 20:38:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set the environment variables" {
|
2016-03-04 23:52:27 +01:00
|
|
|
$expected = "this is a test environment variable"
|
|
|
|
{ $ENV:TESTENVIRONMENTVARIABLE = $expected } | Should Not Throw
|
2015-08-24 20:38:32 +02:00
|
|
|
|
2016-03-04 23:52:27 +01:00
|
|
|
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
|
|
|
|
$ENV:TESTENVIRONMENTVARIABLE | Should Be $expected
|
2015-07-17 00:52:42 +02:00
|
|
|
|
2015-07-15 19:15:39 +02:00
|
|
|
}
|
2015-07-17 00:52:42 +02:00
|
|
|
}
|