inspec/test/unit/resources/virtualization_test.rb
Miah Johnson bfd569fe99 Ensure resources fail that target something that isn't supported (#3231)
* Use fail_resource rather than skip_resource when the platform is not
supported by the resource.

* Update tests to handle failing on unsupported platforms.
Update functional tests.

Signed-off-by: Miah Johnson <miah@chia-pet.org>
2018-07-19 08:16:54 -04:00

18 lines
514 B
Ruby

# encoding: utf-8
require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::Virtualization' do
let(:resource) { MockLoader.new(:ubuntu).load_resource('virtualization') }
it 'fails the resource if OS is not Linux' do
resource = MockLoader.new(:windows).load_resource('virtualization')
resource.resource_failed?.must_equal true
end
it 'returns nil for all properties if no virutalization platform is found' do
resource.system.must_be_nil
resource.role.must_be_nil
end
end