mirror of
https://github.com/inspec/inspec
synced 2024-11-14 00:47:10 +00:00
31 lines
696 B
Ruby
31 lines
696 B
Ruby
|
# encoding: utf-8
|
||
|
# author: Dominik Richter
|
||
|
# author: Christoph Hartmann
|
||
|
|
||
|
describe ContentParser do
|
||
|
let (:parser) { Class.new() { include ContentParser }.new }
|
||
|
|
||
|
describe '#parse_passwd' do
|
||
|
it 'parses nil content' do
|
||
|
parser.parse_passwd(nil).must_equal([])
|
||
|
end
|
||
|
|
||
|
it 'parses an empty passwd line' do
|
||
|
parser.parse_passwd('').must_equal([])
|
||
|
end
|
||
|
|
||
|
it 'parses a valid passwd line' do
|
||
|
info = [{
|
||
|
"name"=>"root",
|
||
|
"password"=>"x",
|
||
|
"uid"=>"0",
|
||
|
"gid"=>"0",
|
||
|
"desc"=>"root",
|
||
|
"home"=>"/root",
|
||
|
"shell"=>"/bin/sh"
|
||
|
}]
|
||
|
parser.parse_passwd('root:x:0:0:root:/root:/bin/sh').must_equal(info)
|
||
|
end
|
||
|
end
|
||
|
end
|