2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/utils/parser"
|
2017-02-22 17:29:49 +00:00
|
|
|
|
2020-01-07 23:02:42 +00:00
|
|
|
describe Inspec::Utils::BsdMountParser do
|
|
|
|
let(:parser) { Class.new { include Inspec::Utils::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
|