mirror of
https://github.com/inspec/inspec
synced 2024-12-26 21:13:25 +00:00
3b97e16b97
* Adds chocolatey package resource * Adds docs for chocolatey_package resource * Differentiate chocolatey package from windows feature Suggested by @frezbo Signed-off-by: David Alexander <opensource@thelonelyghost.com>
27 lines
951 B
Ruby
27 lines
951 B
Ruby
# encoding: utf-8
|
|
# author: David Alexander <opensource@thelonelyghost.com>
|
|
|
|
require 'helper'
|
|
require 'inspec/resource'
|
|
|
|
def skip(*args)
|
|
# noop
|
|
end
|
|
|
|
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')
|
|
_(resource.installed?).must_equal pkg[:installed]
|
|
_(resource.version).must_equal pkg[:version]
|
|
_(resource.info).must_equal pkg
|
|
end
|
|
|
|
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')
|
|
_(resource.installed?).must_equal pkg[:installed]
|
|
_(resource.version).must_equal pkg[:version]
|
|
_(resource.info).must_equal pkg
|
|
end
|
|
end
|