aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox/test
diff options
context:
space:
mode:
authorJohn Duff <duff.john@gmail.com>2019-04-16 08:04:38 -0400
committerJohn Duff <duff.john@gmail.com>2019-07-26 13:04:16 -0400
commit09e5d6d0040211a513d47ea7309af31aa719ed5b (patch)
tree1929703f0cfe002be7e56ce4538cbd6ad5dff69d /actionmailbox/test
parent41bc4c6207147a5eeafa323d763e66c06e61cacf (diff)
downloadrails-09e5d6d0040211a513d47ea7309af31aa719ed5b.tar.gz
rails-09e5d6d0040211a513d47ea7309af31aa719ed5b.tar.bz2
rails-09e5d6d0040211a513d47ea7309af31aa719ed5b.zip
Fix Bcc header missing with emails from conductor and test helpers
Diffstat (limited to 'actionmailbox/test')
-rw-r--r--actionmailbox/test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb21
-rw-r--r--actionmailbox/test/unit/router_test.rb9
2 files changed, 30 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
index 06f5a9d6db..33282d36f7 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
@@ -30,6 +30,27 @@ class Rails::Conductor::ActionMailbox::InboundEmailsControllerTest < ActionDispa
end
end
+ test "create inbound email with bcc" 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>",
+ bcc: "Replies <replies@example.com>",
+ subject: "Hey there",
+ body: "How's it going?"
+ }
+ }
+ end
+
+ mail = ActionMailbox::InboundEmail.last.mail
+ assert_equal %w[ jason@37signals.com ], mail.from
+ assert_equal %w[ replies@example.com ], mail.bcc
+ assert_equal "Hey there", mail.subject
+ assert_equal "How's it going?", mail.body.decoded
+ end
+ end
+
test "create inbound email with attachments" do
with_rails_env("development") do
assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do
diff --git a/actionmailbox/test/unit/router_test.rb b/actionmailbox/test/unit/router_test.rb
index 4dd3730604..7eb8e04a73 100644
--- a/actionmailbox/test/unit/router_test.rb
+++ b/actionmailbox/test/unit/router_test.rb
@@ -51,6 +51,15 @@ module ActionMailbox
assert_equal inbound_email.mail, $processed_mail
end
+ test "single string routing on bcc" do
+ @router.add_routes("first@example.com" => :first)
+
+ inbound_email = create_inbound_email_from_mail(to: "someone@example.com", bcc: "first@example.com", subject: "This is a reply")
+ @router.route inbound_email
+ assert_equal "FirstMailbox", $processed_by
+ assert_equal inbound_email.mail, $processed_mail
+ end
+
test "single string routing case-insensitively" do
@router.add_routes("first@example.com" => :first)