summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-09-04 14:51:17 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-07 11:24:28 -0800
commit929e13cf84149a1d3be91282212e59bc939b2fd0 (patch)
treebd3b29b55bebcf07d2c0364eebb59165d889a4fe
parentd39f2cfb4208b55f054c346a417c7f8564dd2b29 (diff)
downloadchef-929e13cf84149a1d3be91282212e59bc939b2fd0.tar.gz
add some #delete specs
-rw-r--r--spec/unit/node/vivid_mash_spec.rb26
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