2018-12-14 05:06:12 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-24 15:16:22 -05:00
|
|
|
require_relative "../../test_helper"
|
2018-11-05 19:58:07 -05:00
|
|
|
|
|
|
|
module MailExt
|
|
|
|
class RecipientsTest < ActiveSupport::TestCase
|
|
|
|
setup do
|
2018-11-13 17:44:31 -05:00
|
|
|
@mail = Mail.new \
|
|
|
|
to: "david@basecamp.com",
|
|
|
|
cc: "jason@basecamp.com",
|
|
|
|
bcc: "andrea@basecamp.com",
|
|
|
|
x_original_to: "ryan@basecamp.com"
|
2018-11-05 19:58:07 -05:00
|
|
|
end
|
|
|
|
|
2018-11-13 17:44:31 -05:00
|
|
|
test "recipients include everyone from to, cc, bcc, and x-original-to" do
|
|
|
|
assert_equal %w[ david@basecamp.com jason@basecamp.com andrea@basecamp.com ryan@basecamp.com ], @mail.recipients
|
2018-11-05 19:58:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "recipients addresses use address objects" do
|
|
|
|
assert_equal "basecamp.com", @mail.recipients_addresses.first.domain
|
|
|
|
end
|
|
|
|
|
|
|
|
test "to addresses use address objects" do
|
|
|
|
assert_equal "basecamp.com", @mail.to_addresses.first.domain
|
|
|
|
end
|
|
|
|
|
|
|
|
test "cc addresses use address objects" do
|
|
|
|
assert_equal "basecamp.com", @mail.cc_addresses.first.domain
|
|
|
|
end
|
|
|
|
|
|
|
|
test "bcc addresses use address objects" do
|
|
|
|
assert_equal "basecamp.com", @mail.bcc_addresses.first.domain
|
|
|
|
end
|
|
|
|
end
|
2018-11-13 17:44:31 -05:00
|
|
|
end
|