inspec/test/unit/resources/filesystem_test.rb
Jared Quick db96ee9e85
Prevent resources from loading if supports check fails (#2665)
* Prevent resources from loading if supports fail.

Signed-off-by: Jared Quick <jquick@chef.io>
2018-02-16 15:15:53 -05:00

31 lines
890 B
Ruby

require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::FileSystemResource' do
describe 'when loading filesystem in linux' do
let (:resource) { load_resource('filesystem', '/') }
it 'resolves the / partition' do
_(resource.partition).must_equal '/'
end
it 'has more than 1 MB' do
_(resource.size).must_be :>=, 1
end
it 'must equal 28252316 MB' do
_(resource.size).must_equal 28252316
end
end
describe 'when loading filesystem in unsupported OS family' do
it 'fails on Windows' do
resource_fail = MockLoader.new(:windows).load_resource('filesystem', '/')
resource_fail.check_supports.must_equal false
end
it 'fails on FreeBSD (unix-like)' do
resource_fail = MockLoader.new(:freebsd10).load_resource('filesystem', '/')
resource_fail.check_supports.must_equal false
end
end
end