2017-08-29 23:00:02 +01:00
|
|
|
require "./spec_helper"
|
|
|
|
|
|
|
|
describe Imap do
|
|
|
|
# TODO: Write tests
|
|
|
|
|
|
|
|
it "should count emails in mailbox" do
|
2018-09-11 12:18:24 +03:00
|
|
|
imap = Imap::Client.new(host: "127.0.0.1", port: 3993,
|
|
|
|
username: "test", password: "test",
|
|
|
|
verify: OpenSSL::SSL::VerifyMode::NONE)
|
2018-09-10 22:53:48 +03:00
|
|
|
mailboxes = imap.list
|
2017-08-29 23:00:02 +01:00
|
|
|
if mailboxes.size > 0
|
2018-09-10 22:53:48 +03:00
|
|
|
mailbox = mailboxes.first
|
|
|
|
message_count = imap.status(mailbox, ["MESSAGES"])["MESSAGES"]
|
2017-08-29 23:00:02 +01:00
|
|
|
puts "There are #{message_count} message in #{mailbox}"
|
|
|
|
end
|
|
|
|
imap.close
|
|
|
|
end
|
|
|
|
end
|