diff options
author | Phil Dibowitz <phil@ipom.com> | 2014-12-10 19:31:46 -0800 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2014-12-10 19:31:46 -0800 |
commit | 0d9c6de889d2a221bfbed8f705f68ccf913b5bda (patch) | |
tree | b31663e760760bbf1249420da6d812bfbc982a88 | |
parent | 49aa91c6591f8ee287f702db23643caf49dbd936 (diff) | |
download | chef-0d9c6de889d2a221bfbed8f705f68ccf913b5bda.tar.gz |
Add spec
-rw-r--r-- | spec/unit/node_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 1daaf9ec52..0bc76db272 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1213,6 +1213,40 @@ describe Chef::Node do node.save end + it "should save false-y whitelisted attributes" do + Chef::Config[:default_attribute_whitelist] = [ + "foo/bar/baz" + ] + + data = { + "default" => { + "foo" => { + "bar" => { + "baz" => false, + }, + "other" => { + "stuff" => true, + } + } + } + } + + selected_data = { + "default" => { + "foo" => { + "bar" => { + "baz" => false, + } + } + } + } + + node.name("falsey-monkey") + allow(node).to receive(:for_json).and_return(data) + expect(@rest).to receive(:put_rest).with("nodes/falsey-monkey", selected_data).and_return("foo") + node.save + end + it "should not save any attributes if the whitelist is empty" do Chef::Config[:automatic_attribute_whitelist] = [] |