diff options
author | Lachlan Sylvester <lachlan.sylvester@hypothetical.com.au> | 2019-01-07 09:05:39 +1100 |
---|---|---|
committer | Lachlan Sylvester <lachlan.sylvester@hypothetical.com.au> | 2019-01-07 10:56:41 +1100 |
commit | 0419bc35047a62286961feb6e3e0177c9aa18cfa (patch) | |
tree | 8df66e792e1e71696f75980c8b0908e678e24327 /actionmailbox/test | |
parent | 1e09019088760adafaa122eb11c24effdb4c1160 (diff) | |
download | rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.tar.gz rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.tar.bz2 rails-0419bc35047a62286961feb6e3e0177c9aa18cfa.zip |
add attachments to the new inbound mail
Diffstat (limited to 'actionmailbox/test')
-rw-r--r-- | actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb | 34 | ||||
-rw-r--r-- | actionmailbox/test/fixtures/files/avatar1.jpeg | bin | 0 -> 20535 bytes | |||
-rw-r--r-- | actionmailbox/test/fixtures/files/avatar2.jpeg | bin | 0 -> 12686 bytes |
3 files changed, 34 insertions, 0 deletions
diff --git a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb new file mode 100644 index 0000000000..60077d86e2 --- /dev/null +++ b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require "test_helper" + +class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispatch::IntegrationTest + test "create inbound email" do + with_rails_env("development") do + assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do + post rails_conductor_inbound_emails_path, params: { + mail: { + from: "Jason Fried <jason@37signals.com>", + to: "Replies <replies@example.com>", + bcc: "", + in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>", + subject: "Discussion: Let's debate these attachments", + body: "Let's talk about these images:", + attachments: [fixture_file_upload("files/avatar1.jpeg"), fixture_file_upload("files/avatar2.jpeg")] + } + } + end + + assert_equal 2, ActionMailbox::InboundEmail.last.mail.attachments.size + end + end + + private + def with_rails_env(env) + old_rails_env = Rails.env + Rails.env = env + yield + ensure + Rails.env = old_rails_env + end +end diff --git a/actionmailbox/test/fixtures/files/avatar1.jpeg b/actionmailbox/test/fixtures/files/avatar1.jpeg Binary files differnew file mode 100644 index 0000000000..31111c3bc9 --- /dev/null +++ b/actionmailbox/test/fixtures/files/avatar1.jpeg diff --git a/actionmailbox/test/fixtures/files/avatar2.jpeg b/actionmailbox/test/fixtures/files/avatar2.jpeg Binary files differnew file mode 100644 index 0000000000..e844e7f3c6 --- /dev/null +++ b/actionmailbox/test/fixtures/files/avatar2.jpeg |