Merge pull request #1148 from nvtkaszpir/patch-2

Extend example for parse_config.rb
This commit is contained in:
Christoph Hartmann 2016-09-26 01:30:58 +02:00 committed by GitHub
commit a588c7599e

View file

@ -19,10 +19,27 @@ module Inspec::Resources
desc 'Use the parse_config InSpec audit resource to test arbitrary configuration files.'
example "
output = command('some-command').stdout
describe parse_config(output, { data_config_option: value } ) do
its('setting') { should eq 1 }
end
output2 = command('curl http://127.0.0.1/php_status').stdout
# php status is in format 'key : value', and we do not allow for multiple values
options2 = {
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: false
}
describe parse_config(output2, options2) do
its('pool') { should eq 'www'}
its('process manager') { should eq process_manager }
end
# getting specific key from the output above, convert it to integer and then compare
# make sure 'listen queue' is below 100
describe parse_config(output2, options2 ).params['listen queue'].to_i do
it { should be < 100 }
end
"
attr_reader :content