Update parse_config.rb

Extend example section.
This commit is contained in:
Michał Sochoń 2016-09-25 14:02:40 +02:00 committed by GitHub
parent 1768d952a4
commit cdf6f647ac

View file

@ -23,6 +23,27 @@ module Inspec::Resources
describe parse_config(output, { data_config_option: value } ) do describe parse_config(output, { data_config_option: value } ) do
its('setting') { should eq 1 } its('setting') { should eq 1 }
end 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 attr_reader :content