aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/mail_ext/recipients_test.rb
blob: 86db569a531a65483d88cf1c411d97257efc8c7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require_relative '../../test_helper'

module MailExt
  class RecipientsTest < ActiveSupport::TestCase
    setup do
      @mail = Mail.new(to: "david@basecamp.com", cc: "jason@basecamp.com", bcc: "andrea@basecamp.com")
    end

    test "recipients include everyone from to, cc, and bcc" do
      assert_equal %w[ david@basecamp.com jason@basecamp.com andrea@basecamp.com ], @mail.recipients
    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
end