spec/inputs/imap_spec.rb in logstash-input-imap-2.0.5 vs spec/inputs/imap_spec.rb in logstash-input-imap-3.0.0
- old
+ new
@@ -58,11 +58,11 @@
"user" => "#{user}", "password" => "#{password}"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["message"] } == msg_text
+ insist { event.get("message") } == msg_text
end
end
context "when text/html content-type selected" do
it "should select text/html part" do
@@ -71,11 +71,11 @@
"content_type" => "text/html"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["message"] } == msg_html
+ insist { event.get("message") } == msg_html
end
end
end
context "when subject is in RFC 2047 encoded-word format" do
@@ -85,11 +85,11 @@
"user" => "#{user}", "password" => "#{password}"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["subject"] } == "foo : bar"
+ insist { event.get("subject") } == "foo : bar"
end
end
context "with multiple values for same header" do
it "should add 2 values as array in event" do
@@ -100,11 +100,11 @@
"user" => "#{user}", "password" => "#{password}"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["received"] } == ["test1", "test2"]
+ insist { event.get("received") } == ["test1", "test2"]
end
it "should add more than 2 values as array in event" do
subject.received = "test1"
subject.received = "test2"
@@ -114,11 +114,11 @@
"user" => "#{user}", "password" => "#{password}"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["received"] } == ["test1", "test2", "test3"]
+ insist { event.get("received") } == ["test1", "test2", "test3"]
end
end
context "when a header field is nil" do
it "should parse mail" do
@@ -127,9 +127,9 @@
"user" => "#{user}", "password" => "#{password}"}
input = LogStash::Inputs::IMAP.new config
input.register
event = input.parse_mail(subject)
- insist { event["message"] } == msg_text
+ insist { event.get("message") } == msg_text
end
end
end