Methods
C
R
Instance Public methods
create_inbound_email_from_fixture(fixture_name, status: :processing)

Create an InboundEmail record using an eml fixture in the format of message/rfc822 referenced with fixture_name located in test/fixtures/files/fixture_name.

   # File actionmailbox/lib/action_mailbox/test_helper.rb
 9 def create_inbound_email_from_fixture(fixture_name, status: :processing)
10   create_inbound_email_from_source file_fixture(fixture_name).read, status: status
11 end
create_inbound_email_from_mail(status: :processing, **mail_options)

Create an InboundEmail by specifying it using Mail.new options. Example:

create_inbound_email_from_mail(from: "[email protected]", subject: "Hello!")
   # File actionmailbox/lib/action_mailbox/test_helper.rb
16 def create_inbound_email_from_mail(status: :processing, **mail_options)
17   create_inbound_email_from_source Mail.new(mail_options).to_s, status: status
18 end
create_inbound_email_from_source(source, status: :processing)

Create an InboundEmail using the raw rfc822 source as text.

   # File actionmailbox/lib/action_mailbox/test_helper.rb
21 def create_inbound_email_from_source(source, status: :processing)
22   ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status
23 end
receive_inbound_email_from_fixture(*args)

Create an InboundEmail from fixture using the same arguments as create_inbound_email_from_fixture and immediately route it to processing.

   # File actionmailbox/lib/action_mailbox/test_helper.rb
28 def receive_inbound_email_from_fixture(*args)
29   create_inbound_email_from_fixture(*args).tap(&:route)
30 end
receive_inbound_email_from_mail(**kwargs)

Create an InboundEmail using the same arguments as create_inbound_email_from_mail and immediately route it to processing.

   # File actionmailbox/lib/action_mailbox/test_helper.rb
34 def receive_inbound_email_from_mail(**kwargs)
35   create_inbound_email_from_mail(**kwargs).tap(&:route)
36 end
receive_inbound_email_from_source(*args)

Create an InboundEmail using the same arguments as create_inbound_email_from_source and immediately route it to processing.

   # File actionmailbox/lib/action_mailbox/test_helper.rb
40 def receive_inbound_email_from_source(*args)
41   create_inbound_email_from_source(*args).tap(&:route)
42 end