Sha256: ef3a885d16fd74478a20b0910cdd9569b5450ce985cc00966dbcdcc2a9886b4d

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

# encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann

describe PasswdParser do
  let (:parser) { Class.new() { include PasswdParser }.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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inspec-0.9.10 test/unit/utils/passwd_parser_test.rb
inspec-0.9.9 test/unit/utils/passwd_parser_test.rb
inspec-0.9.8 test/unit/utils/passwd_parser_test.rb