summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-03-17 14:41:57 -0700
committerTim Smith <tsmith84@gmail.com>2021-03-17 14:41:57 -0700
commit4d61a6e7a930af66c7e5c2032cfa4be85d703e14 (patch)
tree145e2331379306592831fe3280acb4e9e962df0d
parent74a357453df8693aadcb78ac726adfca45679e6c (diff)
downloadchef-4d61a6e7a930af66c7e5c2032cfa4be85d703e14.tar.gz
Update specs for compliance_phase attribute being false by default
When we're trying to test the magic set it to nil Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/unit/compliance/runner_spec.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/unit/compliance/runner_spec.rb b/spec/unit/compliance/runner_spec.rb
index d166f467c8..66e21eb12e 100644
--- a/spec/unit/compliance/runner_spec.rb
+++ b/spec/unit/compliance/runner_spec.rb
@@ -13,8 +13,16 @@ describe Chef::Compliance::Runner do
describe "#enabled?" do
- it "is true if the node attributes have audit profiles and the audit cookbook is not present" do
+ it "is true if the node attributes have audit profiles and the audit cookbook is not present, and the compliance mode attribute is nil" do
node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" }
+ node.normal["audit"]["compliance_phase"] = nil
+
+ expect(runner).to be_enabled
+ end
+
+ it "is true if the node attributes have audit profiles and the audit cookbook is not present, and the compliance mode attribute is true" do
+ node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" }
+ node.normal["audit"]["compliance_phase"] = true
expect(runner).to be_enabled
end
@@ -26,9 +34,10 @@ describe Chef::Compliance::Runner do
expect(runner).not_to be_enabled
end
- it "is false if the node attributes have audit profiles and the audit cookbook is present" do
+ it "is false if the node attributes have audit profiles and the audit cookbook is present, and the complince mode attribute is nil" do
stub_const("::Reporter::ChefAutomate", true)
node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" }
+ node.normal["audit"]["compliance_phase"] = nil
expect(runner).not_to be_enabled
end
@@ -41,21 +50,25 @@ describe Chef::Compliance::Runner do
expect(runner).to be_enabled
end
- it "is false if the node attributes do not have audit profiles and the audit cookbook is not present" do
+ it "is false if the node attributes do not have audit profiles and the audit cookbook is not present, and the complince mode attribute is nil" do
node.normal["audit"]["profiles"] = {}
+ node.normal["audit"]["compliance_phase"] = nil
expect(runner).not_to be_enabled
end
- it "is false if the node attributes do not have audit profiles and the audit cookbook is present" do
+ it "is false if the node attributes do not have audit profiles and the audit cookbook is present, and the complince mode attribute is nil" do
stub_const("::Reporter::ChefAutomate", true)
node.automatic["recipes"] = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos }
+ node.normal["audit"]["compliance_phase"] = nil
expect(runner).not_to be_enabled
end
- it "is false if the node attributes do not have audit attributes and the audit cookbook is not present" do
+ it "is false if the node attributes do not have audit attributes and the audit cookbook is not present, and the complince mode attribute is nil" do
node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos }
+ node.normal["audit"]["compliance_phase"] = nil
+
expect(runner).not_to be_enabled
end