Skip to content

Commit

Permalink
rubocop: autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak authored and zilchms committed Feb 4, 2024
1 parent dc04ec1 commit e578112
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/facter/psversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
setcode do
powershell = if Facter::Core::Execution.which('powershell.exe')
Facter::Core::Execution.which('powershell.exe')
elsif File.exist?("#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe")
"#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
elsif File.exist?("#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe")
"#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe"
elsif File.exist?("#{ENV.fetch('SYSTEMROOT', nil)}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe")
"#{ENV.fetch('SYSTEMROOT', nil)}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
elsif File.exist?("#{ENV.fetch('SYSTEMROOT', nil)}\\system32\\WindowsPowershell\\v1.0\\powershell.exe")
"#{ENV.fetch('SYSTEMROOT', nil)}\\system32\\WindowsPowershell\\v1.0\\powershell.exe"
end
query = 'Write-Host $PSVersionTable.PSVersion.ToString()'
response = Facter::Core::Execution.execute(%(#{powershell} -command "#{query}"))
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/psversion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
context "on os: #{os}" do
before do
allow(Facter::Core::Execution).to receive(:which).with('powershell.exe').and_return('C:\\powershell.exe')
allow(File).to receive(:exist).with("#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe").and_return(false)
allow(File).to receive(:exist).with("#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe").and_return(false)
allow(File).to receive(:exist).with("#{ENV.fetch('SYSTEMROOT', nil)}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe").and_return(false)
allow(File).to receive(:exist).with("#{ENV.fetch('SYSTEMROOT', nil)}\\system32\\WindowsPowershell\\v1.0\\powershell.exe").and_return(false)
end

it do
Expand Down

0 comments on commit e578112

Please sign in to comment.