From 0ef2fdb119a7196a010cd8081f1631f23f5cef95 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 12 Dec 2018 17:12:48 -0800 Subject: Consistent naming on all factory methods --- lib/action_mailbox/test_helper.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/action_mailbox/test_helper.rb') diff --git a/lib/action_mailbox/test_helper.rb b/lib/action_mailbox/test_helper.rb index 23b2bb02ca..680e8b43be 100644 --- a/lib/action_mailbox/test_helper.rb +++ b/lib/action_mailbox/test_helper.rb @@ -5,14 +5,15 @@ module ActionMailbox # 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+. def create_inbound_email_from_fixture(fixture_name, status: :processing) - create_inbound_email file_fixture(fixture_name).read, status: status + create_inbound_email_from_source file_fixture(fixture_name).read, status: status end def create_inbound_email_from_mail(status: :processing, **mail_options) - create_inbound_email Mail.new(mail_options).to_s, status: status + create_inbound_email_from_source Mail.new(mail_options).to_s, status: status end - def create_inbound_email(source, status: :processing) + # Create an `InboundEmail` using the raw rfc822 `source` as text. + def create_inbound_email_from_source(source, status: :processing) ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status end @@ -23,5 +24,8 @@ module ActionMailbox def receive_inbound_email_from_mail(**kwargs) create_inbound_email_from_mail(**kwargs).tap(&:route) end + def receive_inbound_email_from_source(**kwargs) + create_inbound_email_from_source(**kwargs).tap(&:route) + end end end -- cgit v1.2.3