summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2013-01-29 14:56:06 -0800
committerLamont Granquist <lamont@opscode.com>2013-01-29 14:56:06 -0800
commit66d5a5bb0db640198e2077f699224b504dc127d7 (patch)
treef85d3b4feda2e6b20f200bc729134f5b00842453
parentd5f3c0b6589a34459656d2a68b01929c6f95a2d4 (diff)
downloadchef-66d5a5bb0db640198e2077f699224b504dc127d7.tar.gz
specs to test for set_unless flag badness
-rw-r--r--spec/unit/node_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index d785f84c73..f18fc082f0 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -177,6 +177,13 @@ describe Chef::Node do
node[:snoopy][:is_a_puppy].should == true
end
+ it "should allow you to set a value after a set_unless" do
+ # this tests for set_unless_present state bleeding between statements
+ node.set_unless[:snoopy][:is_a_puppy] = false
+ node.set[:snoopy][:is_a_puppy] = true
+ node[:snoopy][:is_a_puppy].should == true
+ end
+
it "auto-vivifies attributes created via method syntax" do
node.set.fuu.bahrr.baz = "qux"
node.fuu.bahrr.baz.should == "qux"
@@ -201,6 +208,13 @@ describe Chef::Node do
node[:snoopy][:is_a_puppy].should == true
end
+ it "should allow you to set a value after a default_unless" do
+ # this tests for set_unless_present state bleeding between statements
+ node.default_unless[:snoopy][:is_a_puppy] = false
+ node.default[:snoopy][:is_a_puppy] = true
+ node[:snoopy][:is_a_puppy].should == true
+ end
+
it "auto-vivifies attributes created via method syntax" do
node.default.fuu.bahrr.baz = "qux"
node.fuu.bahrr.baz.should == "qux"
@@ -231,6 +245,13 @@ describe Chef::Node do
node[:snoopy][:is_a_puppy].should == true
end
+ it "should allow you to set a value after an override_unless" do
+ # this tests for set_unless_present state bleeding between statements
+ node.override_unless[:snoopy][:is_a_puppy] = false
+ node.override[:snoopy][:is_a_puppy] = true
+ node[:snoopy][:is_a_puppy].should == true
+ end
+
it "auto-vivifies attributes created via method syntax" do
node.override.fuu.bahrr.baz = "qux"
node.fuu.bahrr.baz.should == "qux"