Sha256: 86e615fa75f667521e932862a9874f00df094d3d857bb8e35a48b9f1dcb1df7e
Contents?: true
Size: 890 Bytes
Versions: 3
Compression:
Stored size: 890 Bytes
Contents
module EmailServerHelpers REQUESTED_ATTRIBUTES = ["RFC822", "FLAGS", "INTERNALDATE"] def send_email(folder, options) from = options[:from] || "address@example.org" subject = options[:subject] body = options[:body] message = <<-EOT From: #{from} Subject: #{subject} #{body} EOT imap.append(folder, message, nil, nil) end def delete_emails(folder) imap.select(folder) uids = imap.uid_search(["ALL"]).sort imap.store(1 .. uids.size, "+FLAGS", [:Deleted]) imap.expunge end def imap @imap ||= begin connection = fixture("connection") imap = Net::IMAP.new( connection[:server], connection[:connection_options] ) imap.login(connection[:username], connection[:password]) imap end end end RSpec.configure do |config| config.include EmailServerHelpers, type: :feature end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
imap-backup-1.4.2 | spec/features/support/email_server.rb |
imap-backup-1.4.1 | spec/features/support/email_server.rb |
imap-backup-1.4.0 | spec/features/support/email_server.rb |