From aac4d7f6ff5fad462cec2a521e1b98774ef3bdb2 Mon Sep 17 00:00:00 2001
From: George Claghorn <george@basecamp.com>
Date: Sat, 19 Jan 2019 11:49:50 -0500
Subject: Check all provided attributes of the message

---
 .../action_mailbox/inbound_emails_controller_test.rb | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'actionmailbox/test/controllers')

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 9da1c04303..fcd9ad839f 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
@@ -10,15 +10,19 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
           mail: {
             from: "Jason Fried <jason@37signals.com>",
             to: "Replies <replies@example.com>",
-            bcc: "",
             in_reply_to: "<4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>",
-            subject: "Create",
-            body: "New Mail"
+            subject: "Hey there",
+            body: "How's it going?"
           }
         }
       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
 
@@ -29,18 +33,16 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
           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",
+            subject: "Let's debate some attachments",
             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
 
       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 2, mail.attachments.count
     end
   end
 
-- 
cgit v1.2.3