Class: IMAPToRSS::TestCase
- Inherits:
-
MiniTest::Unit::TestCase
- Object
- MiniTest::Unit::TestCase
- IMAPToRSS::TestCase
- Defined in:
- lib/imap_to_rss/test_case.rb
Overview
Test case for IMAPToRSS handlers
Instance Method Summary collapse
-
#setup(handler) ⇒ Object
Sets this test case up with
handler
. -
#util_mail(options = {}) ⇒ Object
Returns a new TMail::Mail from
options
.
Instance Method Details
#setup(handler) ⇒ Object
Sets this test case up with handler
. Provides instance variables @itor
and @handler
27 28 29 30 31 |
# File 'lib/imap_to_rss/test_case.rb', line 27 def setup(handler) @itor = IMAPToRSS.new @handler = handler @handler.setup @itor end |
#util_mail(options = {}) ⇒ Object
Returns a new TMail::Mail from options
. Defaults are:
- from
- date
-
Time.at 0
- to
- subject
-
subject for this mail
- body
-
Hi! I’m a body!
The mail body will be normalized to rn line breaks.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/imap_to_rss/test_case.rb', line 44 def util_mail( = {}) = { :from => '[email protected]', :date => Time.at(0), :to => '[email protected]', :subject => 'subject for this mail', :body => 'Hi! I\'m a body!' }.merge body = [:body].split(/\r?\n/).join "\r\n" TMail::Mail.parse <<-MAIL From: #{[:from]}\r Date: #{[:date].rfc2822}\r To: #{[:to]}\r Subject: #{[:subject]}\r \r #{body} MAIL end |