2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/chocolatey_package"
|
2018-04-05 12:54:27 +00:00
|
|
|
|
|
|
|
def skip(*args)
|
|
|
|
# noop
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::ChocoPkg" do
|
|
|
|
it "can parse output from `choco` when package is installed" do
|
|
|
|
pkg = { name: "git", installed: false, version: nil, type: "chocolatey" }
|
|
|
|
resource = MockLoader.new(:windows).load_resource("chocolatey_package", "git")
|
2018-04-05 12:54:27 +00:00
|
|
|
_(resource.installed?).must_equal pkg[:installed]
|
2019-01-12 22:09:13 +00:00
|
|
|
_(resource.version).must_be_nil
|
2018-04-05 12:54:27 +00:00
|
|
|
_(resource.info).must_equal pkg
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "can parse output from `choco` when package not installed" do
|
|
|
|
pkg = { name: "nssm", installed: true, version: "2.24.101", type: "chocolatey" }
|
|
|
|
resource = MockLoader.new(:windows).load_resource("chocolatey_package", "nssm")
|
2018-04-05 12:54:27 +00:00
|
|
|
_(resource.installed?).must_equal pkg[:installed]
|
|
|
|
_(resource.version).must_equal pkg[:version]
|
|
|
|
_(resource.info).must_equal pkg
|
|
|
|
end
|
|
|
|
end
|