2
0
Fork 0
mirror of https://github.com/inspec/inspec synced 2024-12-22 11:03:11 +00:00
inspec/test/unit/resources/powershell_test.rb
Ryan Davis a5309ea392 blindly applied chefstyle -a
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:03 -07:00

30 lines
1.1 KiB
Ruby

require "helper"
require "inspec/resource"
require "inspec/resources/powershell"
describe "Inspec::Resources::Powershell" do
let(:base64_command) do
# Encoded version of `$ProgressPreference='SilentlyContinue';Get-Help`
"JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAUwBpAGwA" \
"ZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQAnADsARwBlAHQALQBIAGUAbABwAA=="
end
it "properly generates command" do
resource = MockLoader.new(:windows).load_resource("powershell", "Get-Help")
_(resource.command).must_equal "Get-Help"
resource = MockLoader.new(:osx104).load_resource("powershell", "Get-Help")
_(resource.command).must_equal("pwsh -encodedCommand '#{base64_command}'")
end
it "properly generates command if deprecated `script` is used" do
expect_deprecation(:resource_script) do
resource = MockLoader.new(:windows).load_resource("script", "Get-Help")
_(resource.command).must_equal "Get-Help"
end
expect_deprecation(:resource_script) do
resource = MockLoader.new(:osx104).load_resource("script", "Get-Help")
_(resource.command).must_equal("pwsh -encodedCommand '#{base64_command}'")
end
end
end