summaryrefslogtreecommitdiff
path: root/spec/unit/node_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-11-06 16:57:35 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-11-08 11:30:22 -0800
commit7f6c960bce5950de2619a89166411632e77a9eae (patch)
treee24ed65e4cfd7a7bf1fb00d3306664734b8f8e4f /spec/unit/node_spec.rb
parent58b343284a4f5c9e4ea7fa81cd115fef6be8f2cb (diff)
downloadchef-7f6c960bce5950de2619a89166411632e77a9eae.tar.gz
fix autovivification
Diffstat (limited to 'spec/unit/node_spec.rb')
-rw-r--r--spec/unit/node_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 92d4422c3d..47605de863 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -566,6 +566,13 @@ describe Chef::Node do
})
end
+ it "will autovivify" do
+ node.force_default!["mysql"]["server"] = {
+ "data_dir" => "/my_raid_volume/lib/mysql",
+ }
+ expect( node["mysql"]["server"]["data_dir"] ).to eql("/my_raid_volume/lib/mysql")
+ end
+
it "lower precedence levels aren't removed" do
node.role_override["mysql"]["server"]["port"] = 1234
node.override["mysql"]["server"]["port"] = 2345
@@ -587,9 +594,10 @@ describe Chef::Node do
it "when overwriting a non-hash/array" do
node.override["mysql"] = false
node.force_override["mysql"] = true
- expect { node.force_override!["mysql"]["server"] = {
+ node.force_override!["mysql"]["server"] = {
"data_dir" => "/my_raid_volume/lib/mysql",
- } }.to raise_error(TypeError)
+ }
+ expect( node["mysql"]["server"]["data_dir"] ).to eql("/my_raid_volume/lib/mysql")
end
it "when overwriting an array with a hash" do