Module: EmailSpec::MailerDeliveries
- Included in:
- Deliveries
- Defined in:
- lib/email_spec/deliveries.rb
Instance Method Summary collapse
- #all_emails ⇒ Object
- #last_email_sent ⇒ Object
- #mailbox_for(address) ⇒ Object
- #reset_mailer ⇒ Object
Instance Method Details
#all_emails ⇒ Object
3 4 5 |
# File 'lib/email_spec/deliveries.rb', line 3 def all_emails deliveries end |
#last_email_sent ⇒ Object
7 8 9 |
# File 'lib/email_spec/deliveries.rb', line 7 def last_email_sent deliveries.last || raise("No email has been sent!") end |
#mailbox_for(address) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/email_spec/deliveries.rb', line 19 def mailbox_for(address) deliveries.select { |email| (email.to && email.to.include?(address)) || (email.bcc && email.bcc.include?(address)) || (email.cc && email.cc.include?(address)) } end |
#reset_mailer ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/email_spec/deliveries.rb', line 11 def reset_mailer if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :cache mailer.clear_cache else deliveries.clear end end |