aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2019-01-19 11:18:32 -0500
committerGitHub <noreply@github.com>2019-01-19 11:18:32 -0500
commitc2c10f9262ba00eb9b26632d8ee4b208627f88dd (patch)
tree4cd7359dafbb5491576b69812c7e0d47731d13dc /actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
parent9608b180bfb36cb459e4aa8d8116a065046e1915 (diff)
parent88453093d5c74aad489feb34dc9062f55f258dd9 (diff)
downloadrails-c2c10f9262ba00eb9b26632d8ee4b208627f88dd.tar.gz
rails-c2c10f9262ba00eb9b26632d8ee4b208627f88dd.tar.bz2
rails-c2c10f9262ba00eb9b26632d8ee4b208627f88dd.zip
Merge pull request #34984 from takeyuweb/fix-actionmailbox-create-inbound-emails
Fix that adding attachments lose a body
Diffstat (limited to 'actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb')
-rw-r--r--actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb23
1 files changed, 22 insertions, 1 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
index 60077d86e2..9da1c04303 100644
--- a/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
+++ b/actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb
@@ -12,6 +12,25 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
to: "Replies <replies@example.com>",
bcc: "",
in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>",
+ subject: "Create",
+ body: "New Mail"
+ }
+ }
+ end
+
+ assert_equal "New Mail", ActionMailbox::InboundEmail.last.mail.decoded
+ end
+ end
+
+ test "create inbound email with attachments" 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")]
@@ -19,7 +38,9 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
}
end
- assert_equal 2, ActionMailbox::InboundEmail.last.mail.attachments.size
+ mail = ActionMailbox::InboundEmail.last.mail
+ assert_equal 2, mail.attachments.size
+ assert_equal "Let's talk about these images:", mail.text_part.decoded
end
end