diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-09-04 14:51:17 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-07 11:24:28 -0800 |
commit | 929e13cf84149a1d3be91282212e59bc939b2fd0 (patch) | |
tree | bd3b29b55bebcf07d2c0364eebb59165d889a4fe | |
parent | d39f2cfb4208b55f054c346a417c7f8564dd2b29 (diff) | |
download | chef-929e13cf84149a1d3be91282212e59bc939b2fd0.tar.gz |
add some #delete specs
-rw-r--r-- | spec/unit/node/vivid_mash_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/unit/node/vivid_mash_spec.rb b/spec/unit/node/vivid_mash_spec.rb index 47535647df..f5212bf255 100644 --- a/spec/unit/node/vivid_mash_spec.rb +++ b/spec/unit/node/vivid_mash_spec.rb @@ -299,4 +299,30 @@ describe Chef::Node::VividMash do expect(vivid.respond_to?(:to_h)).to be true end end + + context "#delete" do + it "should delete hash keys" do + vivid['foo'] = 'bar' + expect(vivid.delete('foo')).to eql('bar') + expect(vivid).to eql({}) + end + + it "should delete with symbols converted to strings" do + vivid['foo'] = 'bar' + expect(vivid.delete(:foo)).to eql('bar') + expect(vivid).to eql({}) + end + + it "should delete hash keys set to nil" do + vivid['foo'] = nil + expect(vivid.delete('foo')).to eql(nil) + expect(vivid).to eql({}) + end + + it "should delete hash keys set to nil with symbols converted to strings" do + vivid['foo'] = nil + expect(vivid.delete(:foo)).to eql(nil) + expect(vivid).to eql({}) + end + end end |