Added specs for accessors del method

Fixes #2384
This commit is contained in:
Suyog Rao 2015-01-21 11:52:38 -08:00 committed by Jordan Sissel
parent c62d70ea44
commit 46e96fb0a2

View file

@ -36,6 +36,17 @@ describe LogStash::Util::Accessors, :if => true do
expect(data).to be_empty expect(data).to be_empty
end end
it "should handle delete on non-existent field" do
str = "[foo][bar]"
data = { "hello" => "world" }
accessors = LogStash::Util::Accessors.new(data)
expect(accessors.del(str)).to be_nil
expect(data).not_to be_empty
# assert no side effects
expect(accessors.get("foo")).to be_nil
expect(accessors.get("hello")).to eq("world")
end
it "should set string value" do it "should set string value" do
str = "simple" str = "simple"
data = {} data = {}