Check all provided attributes of the message

This commit is contained in:
George Claghorn 2019-01-19 11:49:50 -05:00
parent c2c10f9262
commit aac4d7f6ff
1 changed files with 11 additions and 9 deletions

View File

@ -10,15 +10,19 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
mail: { mail: {
from: "Jason Fried <jason@37signals.com>", from: "Jason Fried <jason@37signals.com>",
to: "Replies <replies@example.com>", to: "Replies <replies@example.com>",
bcc: "",
in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>", in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>",
subject: "Create", subject: "Hey there",
body: "New Mail" body: "How's it going?"
} }
} }
end end
assert_equal "New Mail", ActionMailbox::InboundEmail.last.mail.decoded mail = ActionMailbox::InboundEmail.last.mail
assert_equal %w[ jason@37signals.com ], mail.from
assert_equal %w[ replies@example.com ], mail.to
assert_equal "4e6e35f5a38b4_479f13bb90078178@small-app-01.mail", mail.in_reply_to
assert_equal "Hey there", mail.subject
assert_equal "How's it going?", mail.body.decoded
end end
end end
@ -29,18 +33,16 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
mail: { mail: {
from: "Jason Fried <jason@37signals.com>", from: "Jason Fried <jason@37signals.com>",
to: "Replies <replies@example.com>", to: "Replies <replies@example.com>",
bcc: "", subject: "Let's debate some attachments",
in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>",
subject: "Discussion: Let's debate these attachments",
body: "Let's talk about these images:", body: "Let's talk about these images:",
attachments: [fixture_file_upload("files/avatar1.jpeg"), fixture_file_upload("files/avatar2.jpeg")] attachments: [ fixture_file_upload("files/avatar1.jpeg"), fixture_file_upload("files/avatar2.jpeg") ]
} }
} }
end end
mail = ActionMailbox::InboundEmail.last.mail mail = ActionMailbox::InboundEmail.last.mail
assert_equal 2, mail.attachments.size
assert_equal "Let's talk about these images:", mail.text_part.decoded assert_equal "Let's talk about these images:", mail.text_part.decoded
assert_equal 2, mail.attachments.count
end end
end end