Skip to content

Instantly share code, notes, and snippets.

@vinyar
Created August 8, 2014 21:22
Show Gist options
  • Save vinyar/c6a4a1b3fc631634a179 to your computer and use it in GitHub Desktop.
Save vinyar/c6a4a1b3fc631634a179 to your computer and use it in GitHub Desktop.
serverspec failing on reg_key numbers
Windows registry key "HKLM\Software\Policies\Microsoft\Power\PowerSettings\3C0BC021-C8A8-4E07-A973-6B14CBCB2B7E" should have property value "ACSettingIndex", :type_dword, "1200"
Failure/Error: it { should have_property_value('ACSettingIndex', :type_dword, '1200')}
$exitCode = 1
$ProgressPreference = "SilentlyContinue"
try {
$success = ((Compare-Object (Get-Item 'Registry::HKLM\Software\Policies\Microsoft\Power\PowerSettings\3C0BC021-C8A8-4E07-A973-6B14CBCB2B7E').GetValue('ACSettingIndex') 4608) -eq $null)
if ($success -is [Boolean] -and $success) { $exitCode = 0 }
} catch {
Write-Output $_.Exception.Message
}
Write-Output "Exiting with code: $exitCode"
exit $exitCode
Exiting with code: 1
expected #has_property_value?("ACSettingIndex", :type_dword, "1200") to return true, got false
# ./test/integration/windows/spec/localhost/2012_spec.rb:144:in `block (2 levels) in <top (required)>'
@vinyar
Copy link
Author

vinyar commented Aug 8, 2014

I didnt find any elegant way of hacking it, so until serverspec is fixed, I converted all of the actual values to what serverspec expects them to be with " .to_s(16) "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment