lib/specinfra/command/windows/base/file.rb in specinfra-2.12.5 vs lib/specinfra/command/windows/base/file.rb in specinfra-2.12.6

- old
+ new

@@ -89,9 +89,15 @@ def check_has_version(name,version) cmd = "((Get-Command '#{name}').FileVersionInfo.ProductVersion -eq '#{version}') -or ((Get-Command '#{name}').FileVersionInfo.FileVersion -eq '#{version}')" Backend::PowerShell::Command.new { exec cmd } end + def check_is_owned_by(file, owner) + Backend::PowerShell::Command.new do + exec %Q!(gci #{file}).GetAccessControl().Owner -eq '#{owner}'! + end + end + private def item_has_attribute item, attribute %Q!((Get-Item -Path "#{item}" -Force).attributes.ToString() -Split ', ') -contains '#{attribute}'! end end