imap-lib/spec/imap_spec.cr

19 lines
545 B
Crystal
Raw Normal View History

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