Module: ActionMailbox::TestHelper
- Included in:
- TestCase
- Defined in:
- lib/action_mailbox/test_helper.rb
Instance Method Summary collapse
-
#create_inbound_email_from_fixture(fixture_name, status: :processing) ⇒ Object
Create an ‘InboundEmail` record using an eml fixture in the format of message/rfc822 referenced with
fixture_namelocated intest/fixtures/files/fixture_name. -
#create_inbound_email_from_mail(status: :processing, **mail_options) ⇒ Object
Create an ‘InboundEmail` by specifying it using `Mail.new` options.
-
#create_inbound_email_from_source(source, status: :processing) ⇒ Object
Create an ‘InboundEmail` using the raw rfc822 `source` as text.
-
#receive_inbound_email_from_fixture(*args) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_fixture` and immediately route it to processing.
-
#receive_inbound_email_from_mail(**kwargs) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_mail` and immediately route it to processing.
-
#receive_inbound_email_from_source(**kwargs) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_source` and immediately route it to processing.
Instance Method Details
#create_inbound_email_from_fixture(fixture_name, status: :processing) ⇒ Object
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.
7 8 9 |
# File 'lib/action_mailbox/test_helper.rb', line 7 def create_inbound_email_from_fixture(fixture_name, status: :processing) create_inbound_email_from_source file_fixture(fixture_name).read, status: status end |
#create_inbound_email_from_mail(status: :processing, **mail_options) ⇒ Object
Create an ‘InboundEmail` by specifying it using `Mail.new` options. Example:
create_inbound_email_from_mail(from: "[email protected]", subject: "Hello!")
14 15 16 |
# File 'lib/action_mailbox/test_helper.rb', line 14 def create_inbound_email_from_mail(status: :processing, **) create_inbound_email_from_source Mail.new().to_s, status: status end |
#create_inbound_email_from_source(source, status: :processing) ⇒ Object
Create an ‘InboundEmail` using the raw rfc822 `source` as text.
19 20 21 |
# File 'lib/action_mailbox/test_helper.rb', line 19 def create_inbound_email_from_source(source, status: :processing) ActionMailbox::InboundEmail. source, status: status end |
#receive_inbound_email_from_fixture(*args) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_fixture` and immediately route it to processing.
26 27 28 |
# File 'lib/action_mailbox/test_helper.rb', line 26 def receive_inbound_email_from_fixture(*args) create_inbound_email_from_fixture(*args).tap(&:route) end |
#receive_inbound_email_from_mail(**kwargs) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_mail` and immediately route it to processing.
32 33 34 |
# File 'lib/action_mailbox/test_helper.rb', line 32 def receive_inbound_email_from_mail(**kwargs) create_inbound_email_from_mail(**kwargs).tap(&:route) end |
#receive_inbound_email_from_source(**kwargs) ⇒ Object
Create an ‘InboundEmail` from fixture using the same arguments as `create_inbound_email_from_source` and immediately route it to processing.
38 39 40 |
# File 'lib/action_mailbox/test_helper.rb', line 38 def receive_inbound_email_from_source(**kwargs) create_inbound_email_from_source(**kwargs).tap(&:route) end |