mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
4b9692c6fd
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
22 lines
858 B
Ruby
22 lines
858 B
Ruby
require "helper"
|
|
require "inspec/resource"
|
|
require "inspec/resources/kernel_parameters"
|
|
|
|
describe "Inspec::Resources::KernelParameters" do
|
|
it "verify kernel_parameters parsing" do
|
|
resource = load_resource("kernel_parameters")
|
|
_(resource.parameters).must_include "net.ipv4.conf.all.forwarding"
|
|
_(resource.values).must_include 1
|
|
end
|
|
|
|
it "verify kernel_parameters parsing using where query" do
|
|
resource = load_resource("kernel_parameters")
|
|
_(resource.where { parameter == "net.ipv4.conf.all.forwarding" }.values).must_equal [1]
|
|
_(resource.where { value == 1 }.parameters).must_include "net.ipv4.conf.all.forwarding"
|
|
end
|
|
|
|
it "verify kernel_parameters parsing using where query with regex" do
|
|
resource = load_resource("kernel_parameters")
|
|
_(resource.where { parameter =~ /^net./ }.entries.length).must_equal 28
|
|
end
|
|
end
|