From 704179251f3a96f7e7f2ed9b28e1524ace3a4927 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Mon, 1 Oct 2018 15:42:32 -0400 Subject: Add a test helper for creating and routing an inbound email --- lib/action_mailbox/test_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/action_mailbox/test_helper.rb b/lib/action_mailbox/test_helper.rb index 65a15a1281..4694f61b8a 100644 --- a/lib/action_mailbox/test_helper.rb +++ b/lib/action_mailbox/test_helper.rb @@ -6,7 +6,7 @@ module ActionMailbox # 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), filename: fixture_name, status: status - end + end def create_inbound_email_from_mail(status: :processing, **mail_options) raw_email = Tempfile.new.tap { |raw_email| raw_email.write Mail.new(mail_options).to_s } @@ -18,5 +18,9 @@ module ActionMailbox ActionDispatch::Http::UploadedFile.new(tempfile: io, filename: filename, type: 'message/rfc822'), status: status end + + def receive_inbound_email_from_mail(**kwargs) + create_inbound_email_from_mail(**kwargs).tap(&:route) + end end end -- cgit v1.2.3