2018-09-18 19:07:06 -04:00
|
|
|
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+.
|
2018-09-18 20:28:35 -04:00
|
|
|
def create_inbound_email(fixture_name, status: :processing)
|
2018-09-19 19:21:53 -04:00
|
|
|
raw_email = ActiveStorage::Blob.create_after_upload! \
|
2018-09-18 19:07:06 -04:00
|
|
|
io: file_fixture(fixture_name).open, filename: fixture_name, content_type: 'message/rfc822'
|
2018-09-19 19:21:53 -04:00
|
|
|
|
|
|
|
ActionMailroom::InboundEmail.create!(status: status, raw_email: raw_email)
|
|
|
|
end
|
2018-09-18 19:07:06 -04:00
|
|
|
end
|
|
|
|
end
|