From 4ded5c5cd930a611fa4d54b01be89b04882daa63 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Mon, 24 Aug 2015 11:38:32 -0700 Subject: [PATCH] added environment variable tests --- .../Test-Environment-Variables.Tests.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pester-tests/Test-Environment-Variables.Tests.ps1 b/src/pester-tests/Test-Environment-Variables.Tests.ps1 index 6bde8f2898..28b58fa74e 100644 --- a/src/pester-tests/Test-Environment-Variables.Tests.ps1 +++ b/src/pester-tests/Test-Environment-Variables.Tests.ps1 @@ -1,15 +1,21 @@ Describe "Test-Environment-Variables" { - It "Should have environment variable" { + It "Should have environment variables" { Get-Item ENV: | Should Not BeNullOrEmpty } - It "Should be able to access the members of the environment variable in two ways" { - (Get-Item ENV:HOME).Value | Should be "/root" + It "Should be able to access the members of the environment variable" { + $test = /usr/bin/whoami + $expected = "/" + $test + (Get-Item ENV:HOME).Value | Should Be $expected (Get-Item ENV:HOSTNAME).Value | Should Not BeNullOrEmpty (Get-Item ENV:PATH).Value | Should Not BeNullOrEmpty + } + + It "Should be able to set the environment variables" { + { $ENV:TESTENVIRONMENTVARIABLE = "this is a test environment variable" } | Should Not Throw + + $ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty + $ENV:TESTENVIRONMENTVARIABLE | Should Be "this is a test environment variable" - (ls ENV:HOME).Value | Should be "/root" - (ls ENV:HOSTNAME).Value | Should Not BeNullOrEmpty - (ls ENV:PATH).Value | Should Not BeNullOrEmpty } }