Sha256: 81400493b901579eaf71f69c298f967139b60847700eb7b375b8dc9144128dfd
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'abstract_unit' require 'mailers/base_mailer' require 'active_support/log_subscriber/test_helper' require 'action_mailer/log_subscriber' class AMLogSubscriberTest < ActionMailer::TestCase include ActiveSupport::LogSubscriber::TestHelper def setup super ActionMailer::LogSubscriber.attach_to :action_mailer end class TestMailer < ActionMailer::Base def receive(mail) # Do nothing end end def set_logger(logger) ActionMailer::Base.logger = logger end def test_deliver_is_notified BaseMailer.welcome.deliver_now wait assert_equal(1, @logger.logged(:info).size) assert_match(/Sent mail to system@test.lindsaar.net/, @logger.logged(:info).first) assert_equal(2, @logger.logged(:debug).size) assert_match(/BaseMailer#welcome: processed outbound mail in [\d.]+ms/, @logger.logged(:debug).first) assert_match(/Welcome/, @logger.logged(:debug).second) ensure BaseMailer.deliveries.clear end def test_receive_is_notified fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email") TestMailer.receive(fixture) wait assert_equal(1, @logger.logged(:info).size) assert_match(/Received mail/, @logger.logged(:info).first) assert_equal(1, @logger.logged(:debug).size) assert_match(/Jamis/, @logger.logged(:debug).first) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activejob-lock-0.0.2 | rails/actionmailer/test/log_subscriber_test.rb |
activejob-lock-0.0.1 | rails/actionmailer/test/log_subscriber_test.rb |