Class: Emailer::MockSmtpFacade
- Inherits:
-
SmtpFacade
- Object
- SmtpFacade
- Emailer::MockSmtpFacade
- Defined in:
- lib/emailer/mock_smtp_facade.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#sent ⇒ Object
readonly
Returns the value of attribute sent.
Attributes inherited from SmtpFacade
#error, #offending_mail, #settings
Instance Method Summary collapse
-
#get_net_smtp_instance ⇒ Object
Don’t open connections…
- #get_url_for(uuidString) ⇒ Object
-
#initialize(settings = {}) ⇒ MockSmtpFacade
constructor
A new instance of MockSmtpFacade.
- #last_email_sent ⇒ Object
- #last_email_sent_key ⇒ Object
- #last_email_sent_url ⇒ Object
-
#send_mail(options) ⇒ Object
And save, don’t send, mail…
Methods inherited from SmtpFacade
Constructor Details
#initialize(settings = {}) ⇒ MockSmtpFacade
Returns a new instance of MockSmtpFacade.
16 17 18 19 |
# File 'lib/emailer/mock_smtp_facade.rb', line 16 def initialize(settings = {}) @sent = {} super end |
Instance Attribute Details
#sent ⇒ Object (readonly)
Returns the value of attribute sent.
14 15 16 |
# File 'lib/emailer/mock_smtp_facade.rb', line 14 def sent @sent end |
Instance Method Details
#get_net_smtp_instance ⇒ Object
Don’t open connections…
22 23 24 |
# File 'lib/emailer/mock_smtp_facade.rb', line 22 def get_net_smtp_instance MockNetSmtp.new end |
#get_url_for(uuidString) ⇒ Object
51 52 53 |
# File 'lib/emailer/mock_smtp_facade.rb', line 51 def get_url_for uuidString TestingMiddleware.testing_path+uuidString end |
#last_email_sent ⇒ Object
39 40 41 |
# File 'lib/emailer/mock_smtp_facade.rb', line 39 def last_email_sent @sent[@sent.keys.last.to_s] end |
#last_email_sent_key ⇒ Object
43 44 45 |
# File 'lib/emailer/mock_smtp_facade.rb', line 43 def last_email_sent_key @sent.keys.last end |
#last_email_sent_url ⇒ Object
47 48 49 |
# File 'lib/emailer/mock_smtp_facade.rb', line 47 def last_email_sent_url get_url_for last_email_sent_key end |
#send_mail(options) ⇒ Object
And save, don’t send, mail…
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/emailer/mock_smtp_facade.rb', line 27 def send_mail() raise ConnectionNotOpenError unless @open @sent[UUID.new.generate] = true rescue ConnectionNotOpenError => e raise e rescue StandardError => e @error = e @offending_mail = false end |