Sha256: 5f8f015b982fb6fe3d20e696a5ce3562f77e4e7aaa6fcbcd223982d353deede3
Contents?: true
Size: 1.34 KB
Versions: 44
Compression:
Stored size: 1.34 KB
Contents
require "spec_helper" describe Chef::Compliance::Reporter::AuditEnforcer do let(:reporter) { Chef::Compliance::Reporter::AuditEnforcer.new } it "does not raise error for a successful InSpec report" do report = { "profiles": [ { "controls": [ { "id": "c1", "results": [{ "status": "passed" }] }, { "id": "c2", "results": [{ "status": "passed" }] }, ], }, ], } expect(reporter.send_report(report)).to eq(true) end it "does not raise error for an InSpec report with no controls" do report = { "profiles": [{ "name": "empty" }] } expect(reporter.send_report(report)).to eq(true) end it "does not raise error for an InSpec report with controls but no results" do report = { "profiles": [{ "controls": [{ "id": "empty" }] }] } expect(reporter.send_report(report)).to eq(true) end it "raises an error for a failed InSpec report" do report = { "profiles": [ { "controls": [ { "id": "c1", "results": [{ "status": "passed" }] }, { "id": "c2", "results": [{ "status": "failed" }] }, ], }, ], } expect { reporter.send_report(report) }.to raise_error(Chef::Compliance::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.") end end
Version data entries
44 entries across 44 versions & 1 rubygems