mirror of
https://github.com/inspec/inspec
synced 2024-11-24 05:33:17 +00:00
adaf2bc364
This speeds up parallel unit test runs from a very consistent 2:49 to a very consistent 1:53, or a 33% reduction. Signed-off-by: Ryan Davis <zenspider@chef.io>
25 lines
921 B
Ruby
25 lines
921 B
Ruby
require 'helper'
|
|
|
|
describe 'Inspec::Resources::ParseConfig' do
|
|
|
|
it 'verify parse_config resource' do
|
|
options = {
|
|
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/
|
|
}
|
|
resource = MockLoader.new(:centos6).load_resource('parse_config', 'kernel.domainname = example.com', options)
|
|
result = {"kernel.domainname"=>"example.com"}
|
|
_(resource.params).must_equal result
|
|
_(resource.content).must_equal 'kernel.domainname = example.com'
|
|
_(resource.send('kernel.domainname')).must_equal 'example.com'
|
|
end
|
|
|
|
it 'verify parse_config_file resource' do
|
|
options = {
|
|
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/
|
|
}
|
|
resource = MockLoader.new(:centos6).load_resource('parse_config_file', '/etc/sysctl.conf', options)
|
|
result = {"kernel.domainname"=>"example.com"}
|
|
_(resource.params).must_equal result
|
|
_(resource.send('kernel.domainname')).must_equal 'example.com'
|
|
end
|
|
end
|