2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/utils/parser"
|
2017-02-22 17:29:49 +00:00
|
|
|
|
|
|
|
describe BsdMountParser do
|
2019-07-09 00:20:30 +00:00
|
|
|
let(:parser) { Class.new { include BsdMountParser }.new }
|
2017-02-22 17:29:49 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "#parse_mount_options" do
|
|
|
|
it "parses nil content" do
|
2019-09-30 22:31:55 +00:00
|
|
|
_(parser.parse_mount_options(nil)).must_equal({})
|
2017-02-22 17:29:49 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "parses an empty mount line" do
|
2019-09-30 22:31:55 +00:00
|
|
|
_(parser.parse_mount_options("")).must_equal({})
|
2017-02-22 17:29:49 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "parses a valid mount line" do
|
2017-02-22 17:29:49 +00:00
|
|
|
info = {
|
2019-06-11 22:24:35 +00:00
|
|
|
device: "tank/tmp",
|
|
|
|
type: "zfs",
|
|
|
|
options: %w{local noexec nosuid nfsv4acls},
|
2017-02-22 17:29:49 +00:00
|
|
|
}
|
2019-09-30 22:31:55 +00:00
|
|
|
_(parser.parse_mount_options("tank/tmp on /tmp (zfs, local, noexec, nosuid, nfsv4acls)")).must_equal(info)
|
2017-02-22 17:29:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|