diff options
author | George Claghorn <george@basecamp.com> | 2018-10-01 15:42:32 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-10-01 15:42:35 -0400 |
commit | 704179251f3a96f7e7f2ed9b28e1524ace3a4927 (patch) | |
tree | 620db65f73edd88372dfbd5d79aee3ef69b90e7a /lib/action_mailbox | |
parent | dd593b98b5ef6e66d72942065dd1c0a9b266b9bc (diff) | |
download | rails-704179251f3a96f7e7f2ed9b28e1524ace3a4927.tar.gz rails-704179251f3a96f7e7f2ed9b28e1524ace3a4927.tar.bz2 rails-704179251f3a96f7e7f2ed9b28e1524ace3a4927.zip |
Add a test helper for creating and routing an inbound email
Diffstat (limited to 'lib/action_mailbox')
-rw-r--r-- | lib/action_mailbox/test_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |