summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2017-08-10 14:11:48 -0700
committerDJ Mountney <david@twkie.net>2017-08-10 14:11:48 -0700
commitbc5acbe0d0f1d7e1de409694ff56cd721598c31f (patch)
treedd05e416d1fa4acaf320053e08bd04dbc7d03d18 /spec
parent7372d0ece166ee0d5a3e25bf84861807995e58be (diff)
downloadchef-bc5acbe0d0f1d7e1de409694ff56cd721598c31f.tar.gz
Fix an issue where DeepMerge overwrites nil values
When run against a VividMash. Call .key? instead of [] when checking if a key exists for a VividMash Otherwise the VividMash will return an empty object instead of nil for that key. Signed-off-by: DJ Mountney <david@twkie.net>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/node_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 73f0e6da09..b6798b2de9 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -337,6 +337,13 @@ describe Chef::Node do
node.override_unless[:decontamination] = "foo"
expect(node.override[:decontamination]).to eql("foo")
end
+
+ it "consume_attributes does not exhibit chef/chef/issues/6302 bug" do
+ node.normal["a"]["r1"] = nil
+ node.consume_attributes({"a" => { "r2" => nil}})
+ expect(node["a"]["r1"]).to be_nil
+ expect(node["a"]["r2"]).to be_nil
+ end
end
describe "default attributes" do