summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2014-12-10 19:31:46 -0800
committerPhil Dibowitz <phil@ipom.com>2014-12-10 19:31:46 -0800
commit0d9c6de889d2a221bfbed8f705f68ccf913b5bda (patch)
treeb31663e760760bbf1249420da6d812bfbc982a88
parent49aa91c6591f8ee287f702db23643caf49dbd936 (diff)
downloadchef-0d9c6de889d2a221bfbed8f705f68ccf913b5bda.tar.gz
Add spec
-rw-r--r--spec/unit/node_spec.rb34
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] = []