diff options
Diffstat (limited to 'spec/unit/compliance/runner_spec.rb')
-rw-r--r-- | spec/unit/compliance/runner_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/compliance/runner_spec.rb b/spec/unit/compliance/runner_spec.rb index f9f3d61dd2..d4d2ba563f 100644 --- a/spec/unit/compliance/runner_spec.rb +++ b/spec/unit/compliance/runner_spec.rb @@ -137,4 +137,32 @@ describe Chef::Compliance::Runner do expect { runner.reporter("tacos") }.to raise_error(/'tacos' is not a supported reporter for Compliance Phase/) end end + + describe "#inspec_opts" do + it "does not include chef_node in inputs by default" do + node.normal["audit"]["attributes"] = { + "tacos" => "lunch", + "nachos" => "dinner", + } + + inputs = runner.inspec_opts[:inputs] + + expect(inputs["tacos"]).to eq("lunch") + expect(inputs.key?("chef_node")).to eq(false) + end + + it "includes chef_node in inputs with chef_node_attribute_enabled set" do + node.normal["audit"]["chef_node_attribute_enabled"] = true + node.normal["audit"]["attributes"] = { + "tacos" => "lunch", + "nachos" => "dinner", + } + + inputs = runner.inspec_opts[:inputs] + + expect(inputs["tacos"]).to eq("lunch") + expect(inputs["chef_node"]["audit"]["reporter"]).to eq("json-file") + expect(inputs["chef_node"]["chef_environment"]).to eq("_default") + end + end end |