diff options
Diffstat (limited to 'spec/functional/win32')
-rw-r--r-- | spec/functional/win32/crypto_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb index 145c9881b9..5fcbca02b6 100644 --- a/spec/functional/win32/crypto_spec.rb +++ b/spec/functional/win32/crypto_spec.rb @@ -37,15 +37,15 @@ describe "Chef::ReservedNames::Win32::Crypto", :windows_only do it "can be decrypted by powershell" do encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext) resource = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context) - resource.code <<-EOF -$encrypted = '#{encrypted}' | ConvertTo-SecureString -$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted) -$plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) -if ($plaintext -ne '#{plaintext}') { - Write-Error 'Got: ' $plaintext - exit 1 -} -exit 0 + resource.code <<~EOF + $encrypted = '#{encrypted}' | ConvertTo-SecureString + $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted) + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) + if ($plaintext -ne '#{plaintext}') { + Write-Error 'Got: ' $plaintext + exit 1 + } + exit 0 EOF resource.returns(0) resource.run_action(:run) |