mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
4270eb8e80
`must_equal nil` will fail in MiniTest 6. Changing those to `must_be_nil` quiets down all the warnings we currently see and preps us for Minitest 6. Signed-off-by: Adam Leff <adam@leff.co>
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
# encoding: utf-8
|
|
# author: Christoph Hartmann
|
|
# author: Dominik Richter
|
|
|
|
require 'helper'
|
|
require 'inspec/resource'
|
|
|
|
describe 'Inspec::Resources::OneGet' do
|
|
|
|
it 'verify oneget package detail parsing' do
|
|
resource = MockLoader.new(:windows).load_resource('oneget', 'Mozilla Firefox')
|
|
pkg = {
|
|
name: 'Mozilla Firefox 40.0.3 (x86 en-US)',
|
|
version: '40.0.3',
|
|
type: 'oneget',
|
|
installed: true,
|
|
}
|
|
_(resource.installed?).must_equal true
|
|
_(resource.version).must_equal '40.0.3'
|
|
_(resource.info).must_equal pkg
|
|
end
|
|
|
|
# catch cases where we recieve multiple return values
|
|
# eg. happens if you do 'choco install ruby'
|
|
it 'filter dups of Get-Package' do
|
|
resource = MockLoader.new(:windows).load_resource('oneget', 'Ruby 2.1.6-p336-x64')
|
|
pkg = {
|
|
name: 'Ruby 2.1.6-p336-x64',
|
|
version: '2.1.6-p336',
|
|
type: 'oneget',
|
|
installed: true,
|
|
}
|
|
_(resource.installed?).must_equal true
|
|
_(resource.version).must_equal '2.1.6-p336'
|
|
_(resource.info).must_equal pkg
|
|
end
|
|
|
|
it 'should skip on linux' do
|
|
resource = MockLoader.new(:centos7).load_resource('oneget', 'Not available')
|
|
pkg = { type: 'oneget', installed: false }
|
|
_(resource.installed?).must_equal false
|
|
_(resource.version).must_be_nil
|
|
_(resource.info).must_equal pkg
|
|
end
|
|
end
|