Module: Courrier::Test

Defined in:
lib/courrier/test.rb

Defined Under Namespace

Classes: Delivery

Class Method Summary collapse

Class Method Details

.clear!Object



16
17
18
# File 'lib/courrier/test.rb', line 16

def clear!
  @deliveries = []
end

.deliveriesObject



12
13
14
# File 'lib/courrier/test.rb', line 12

def deliveries
  @deliveries ||= []
end

.record(email, result) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/courrier/test.rb', line 20

def record(email, result)
  deliveries << Delivery.new(
    email_class: email.class.name,
    to: email.options.to,
    from: email.options.from,
    reply_to: email.options.reply_to,
    cc: email.options.cc,
    bcc: email.options.bcc,
    subject: email.options.subject,
    body: {text: email.options.text, html: email.options.html},
    headers: email.class.headers,
    provider: email.provider,
    result: result,
    timestamp: Time.now
  )
end