aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_mailroom
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_mailroom')
-rw-r--r--lib/action_mailroom/test_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/action_mailroom/test_helper.rb b/lib/action_mailroom/test_helper.rb
new file mode 100644
index 0000000000..af9e3ad559
--- /dev/null
+++ b/lib/action_mailroom/test_helper.rb
@@ -0,0 +1,13 @@
+module ActionMailroom
+ module TestHelper
+ # 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(fixture_name)
+ ActionMailroom::InboundEmail.create!.tap do |inbound_email|
+ inbound_email.raw_email.attach \
+ ActiveStorage::Blob.create_after_upload! \
+ io: file_fixture(fixture_name).open, filename: fixture_name, content_type: 'message/rfc822'
+ end
+ end
+ end
+end