diff options
Diffstat (limited to 'spec/unit/node_spec.rb')
-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" |