mirror of
https://github.com/inspec/inspec
synced 2024-12-24 20:13:16 +00:00
79f48afa6c
before, the resource would throw an exception when include_files returned nil (i.e., [].flatten!) added basic unit tests capturing the include_files behaviour
31 lines
911 B
Ruby
31 lines
911 B
Ruby
# encoding: utf-8
|
|
# author: Stephan Renatus
|
|
|
|
require 'helper'
|
|
|
|
describe 'Inspec::Resources::ApacheConf' do
|
|
let(:resource) { load_resource('apache_conf') }
|
|
|
|
it 'verify content is a string' do
|
|
_(resource.content).must_be_kind_of String
|
|
end
|
|
|
|
it 'verify params is a hashmap' do
|
|
_(resource.params).must_be_kind_of Hash
|
|
end
|
|
|
|
it 'reads values in apache2.conf' do
|
|
_(resource.params('ServerRoot')).must_equal ['"/etc/apache2"']
|
|
end
|
|
|
|
it 'reads values in from the direct include ports.conf' do
|
|
_(resource.params('Listen').sort).must_equal ['443', '80']
|
|
end
|
|
|
|
it 'reads values in from wildcard include serve-cgi-bin.conf' do
|
|
# TODO(sr) currently, the parser only merges parameter across separate
|
|
# source files, not in one file
|
|
_(resource.params('Define')).must_equal ['ENABLE_USR_LIB_CGI_BIN',
|
|
'ENABLE_USR_LIB_CGI_BIN']
|
|
end
|
|
end
|