summaryrefslogtreecommitdiff
path: root/spec/unit/node
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-25 17:14:32 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-25 17:14:32 -0800
commitf71f535714c84b7106ed7620b6da85d2fadbd03c (patch)
tree68d4b6d29a514899c745fb242f8c0d7be05a235a /spec/unit/node
parent1cf3a2815e3f244a866521a564531878e00b1e69 (diff)
downloadchef-f71f535714c84b7106ed7620b6da85d2fadbd03c.tar.gz
fix errors when merging deeply nested values
Diffstat (limited to 'spec/unit/node')
-rw-r--r--spec/unit/node/attribute_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index 8c654679fe..fac898be26 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -307,6 +307,17 @@ describe Chef::Node::Attribute do
@attributes.role_override["array"] = %w{role}
@attributes["array"].should == %w{role}
end
+
+ it "merges nested hashes between precedence levels" do
+ @attributes = Chef::Node::Attribute.new({}, {}, {}, {})
+ @attributes.env_default = {"a" => {"b" => {"default" => "default"}}}
+ @attributes.normal = {"a" => {"b" => {"normal" => "normal"}}}
+ @attributes.override = {"a" => {"override" => "role"}}
+ @attributes.automatic = {"a" => {"automatic" => "auto"}}
+ @attributes["a"].should == {"b"=>{"default"=>"default", "normal"=>"normal"},
+ "override"=>"role",
+ "automatic"=>"auto"}
+ end
end
describe "when reading combined default or override values" do