Module: EmailSpec::Deliveries
- Included in:
- EmailViewer, Helpers
- 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
21 22 23 |
# File 'lib/email_spec/deliveries.rb', line 21 def mailbox_for(address) deliveries.select { |email| email.destinations.include?(address) } end |
#reset_mailer ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/email_spec/deliveries.rb', line 11 def reset_mailer if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :activerecord Email.delete_all elsif defined?(ActionMailer) && ActionMailer::Base.delivery_method == :cache mailer.clear_cache else deliveries.clear end end |