Sha256: 0fe0e53ac2a8e8842957f812132aa11fde972c4885b5e1ccca3407758bdbf70e
Contents?: true
Size: 1.06 KB
Versions: 16
Compression:
Stored size: 1.06 KB
Contents
RSpec::Matchers.define :run_under_account do |account_name| match do |service| @runner = Specinfra::Runner command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName -eq '#{account_name}'") command_result.stdout.strip == 'True' end failure_message do |service| command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName") "Expected service '#{service.name}' to be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'" end failure_message_when_negated do |service| command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName") "Expected service '#{service.name}' to not be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'" end end
Version data entries
16 entries across 16 versions & 1 rubygems