diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-09-04 14:51:17 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-09-08 15:31:32 -0700 |
commit | 980e09f58923c5c750f48f83f58a0c82ec9140cb (patch) | |
tree | 822bf9bc66fc19d023b6845917c75ae038cde351 | |
parent | db66f7d4a5dee89874572752d1836ab555a0d45a (diff) | |
download | chef-980e09f58923c5c750f48f83f58a0c82ec9140cb.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 |