diff options
author | danielsdeleo <dan@opscode.com> | 2013-01-29 15:42:26 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-01-29 15:42:26 -0800 |
commit | b4fbb9bd3a6aeae9d3ff218f877da1ade1bba101 (patch) | |
tree | 71cf184908b864caba51ea1214430d489917c560 | |
parent | 01dde6e1958d236d1e2bd70b3b7efb263bac6daf (diff) | |
download | chef-b4fbb9bd3a6aeae9d3ff218f877da1ade1bba101.tar.gz |
[CHEF-3806] add tests for "dangling" set_unless state bleed
-rw-r--r-- | spec/unit/node_spec.rb | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index f18fc082f0..3d32902b94 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -178,12 +178,20 @@ describe Chef::Node do end it "should allow you to set a value after a set_unless" do - # this tests for set_unless_present state bleeding between statements + # this tests for set_unless_present state bleeding between statements CHEF-3806 node.set_unless[:snoopy][:is_a_puppy] = false node.set[:snoopy][:is_a_puppy] = true node[:snoopy][:is_a_puppy].should == true end + it "should let you set a value after a 'dangling' set_unless" do + # this tests for set_unless_present state bleeding between statements CHEF-3806 + node.set[:snoopy][:is_a_puppy] = "what" + node.set_unless[:snoopy][:is_a_puppy] + 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" @@ -209,12 +217,20 @@ describe Chef::Node do end it "should allow you to set a value after a default_unless" do - # this tests for set_unless_present state bleeding between statements + # this tests for set_unless_present state bleeding between statements CHEF-3806 node.default_unless[:snoopy][:is_a_puppy] = false node.default[:snoopy][:is_a_puppy] = true node[:snoopy][:is_a_puppy].should == true end + it "should allow you to set a value after a 'dangling' default_unless" do + # this tests for set_unless_present state bleeding between statements CHEF-3806 + node.default[:snoopy][:is_a_puppy] = "what" + node.default_unless[:snoopy][:is_a_puppy] + 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" @@ -246,12 +262,20 @@ describe Chef::Node do end it "should allow you to set a value after an override_unless" do - # this tests for set_unless_present state bleeding between statements + # this tests for set_unless_present state bleeding between statements CHEF-3806 node.override_unless[:snoopy][:is_a_puppy] = false node.override[:snoopy][:is_a_puppy] = true node[:snoopy][:is_a_puppy].should == true end + it "should allow you to set a value after a 'dangling' override_unless" do + # this tests for set_unless_present state bleeding between statements CHEF-3806 + node.override_unless[:snoopy][:is_a_puppy] = "what" + node.override_unless[:snoopy][:is_a_puppy] + 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" |