Sha256: 37c7a9e435f05a1a028ae155807c47e825a11187299c04fd181f2810c8f0308b

Contents?: true

Size: 779 Bytes

Versions: 3

Compression:

Stored size: 779 Bytes

Contents

require 'test/unit'
require 'action_mailer'
require 'action_mailer/ar_mailer'

##
# Pretend mailer

class Mailer < ActionMailer::ARMailer

  def mail
    @mail = Object.new
    def @mail.encoded() 'email' end
    def @mail.from() ['nobody@example.com'] end
    def @mail.destinations() %w[user1@example.com user2@example.com] end
  end

end

class TestARMailer < Test::Unit::TestCase

  def setup
    Email.records.clear
  end

  def test_perform_delivery_activerecord
    Mailer.deliver_mail

    assert_equal 2, Email.records.length

    record = Email.records.first
    assert_equal 'email', record.mail
    assert_equal 'user1@example.com', record.to
    assert_equal 'nobody@example.com', record.from

    assert_equal 'user2@example.com', Email.records.last.to
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ar_mailer-1.0.0 test/test_armailer.rb
ar_mailer-1.0.1 test/test_armailer.rb
ar_mailer-1.1.0 test/test_armailer.rb