inspec/test/unit/resources/postfix_conf_test.rb
Lance Albertson 1e94e3503e Fix for postfix_conf when using a non-standard config location
Pass the first argument of the opts array instead of the whole array which
confuses the SimpleConfig parser. Also added a test which verifies this fixes
the issue.

In addition, change the base_name to something that matches other resource base
names.

Signed-off-by: Lance Albertson <lance@osuosl.org>
2019-09-03 15:28:44 -07:00

20 lines
798 B
Ruby

require "helper"
require "inspec/resource"
require "inspec/resources/postfix_conf"
describe "Inspec::Resources::Postfix_Conf" do
it "Test default parsing of main.cf on Centos 7" do
resource = MockLoader.new(:centos7).load_resource("postfix_conf")
result = { "test_parameter" => "value", "other_test_param" => "$value" }
_(resource.params).must_equal result
_(resource.value(%w{test_parameter})).must_equal "value"
end
it "Test default parsing of other.cf on Centos 7" do
resource = MockLoader.new(:centos7).load_resource("postfix_conf", "/etc/postfix/other.cf")
result = { "test_parameter_other" => "value", "other_test_param_other" => "$value" }
_(resource.params).must_equal result
_(resource.value(%w{test_parameter_other})).must_equal "value"
end
end