aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_mailbox/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_mailbox/test_helper.rb')
-rw-r--r--lib/action_mailbox/test_helper.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/action_mailbox/test_helper.rb b/lib/action_mailbox/test_helper.rb
index b1d7af33f9..23b2bb02ca 100644
--- a/lib/action_mailbox/test_helper.rb
+++ b/lib/action_mailbox/test_helper.rb
@@ -5,18 +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), filename: fixture_name, status: status
+ create_inbound_email file_fixture(fixture_name).read, status: status
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 }
- create_inbound_email(raw_email, status: status)
+ create_inbound_email Mail.new(mail_options).to_s, status: status
end
- def create_inbound_email(io, filename: 'mail.eml', status: :processing)
- ActionMailbox::InboundEmail.create_and_extract_message_id! \
- ActionDispatch::Http::UploadedFile.new(tempfile: io, filename: filename, type: 'message/rfc822'),
- status: status
+ def create_inbound_email(source, status: :processing)
+ ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status
end
def receive_inbound_email_from_fixture(*args)