Class: FastMailer::MockSMTP
- Inherits:
-
Object
- Object
- FastMailer::MockSMTP
- Defined in:
- lib/fast-mailer/mock_smtp.rb
Overview
Original mockup from ActionMailer
Class Method Summary collapse
Instance Method Summary collapse
- #enable_starttls_auto ⇒ Object
-
#enable_tls(context = nil) ⇒ Object
in the standard lib: net/smtp.rb line 577 a TypeError is thrown unless this arg is a kind of OpenSSL::SSL::SSLContext.
-
#initialize(*args) ⇒ MockSMTP
constructor
A new instance of MockSMTP.
- #sendmail(mail, from, to) ⇒ Object
- #start(*args) {|_self| ... } ⇒ Object
Constructor Details
#initialize(*args) ⇒ MockSMTP
Returns a new instance of MockSMTP.
10 11 12 |
# File 'lib/fast-mailer/mock_smtp.rb', line 10 def initialize(*args) @@deliveries ||= [] end |
Class Method Details
.clear_deliveries ⇒ Object
22 23 24 |
# File 'lib/fast-mailer/mock_smtp.rb', line 22 def self.clear_deliveries @@deliveries = [] end |
.deliveries ⇒ Object
6 7 8 |
# File 'lib/fast-mailer/mock_smtp.rb', line 6 def self.deliveries @@deliveries end |
Instance Method Details
#enable_starttls_auto ⇒ Object
39 40 41 |
# File 'lib/fast-mailer/mock_smtp.rb', line 39 def enable_starttls_auto true end |
#enable_tls(context = nil) ⇒ Object
in the standard lib: net/smtp.rb line 577
a TypeError is thrown unless this arg is a
kind of OpenSSL::SSL::SSLContext
29 30 31 32 33 34 35 36 37 |
# File 'lib/fast-mailer/mock_smtp.rb', line 29 def enable_tls(context = nil) if context && context.kind_of?(OpenSSL::SSL::SSLContext) true elsif context raise TypeError, "wrong argument (#{context.class})! "+ "(Expected kind of OpenSSL::SSL::SSLContext)" end end |
#sendmail(mail, from, to) ⇒ Object
14 15 16 |
# File 'lib/fast-mailer/mock_smtp.rb', line 14 def sendmail(mail, from, to) @@deliveries << [mail, from, to] end |
#start(*args) {|_self| ... } ⇒ Object
18 19 20 |
# File 'lib/fast-mailer/mock_smtp.rb', line 18 def start(*args) yield self end |