class AMLogSubscriberTest
Public Instance Methods
set_logger(logger)
click to toggle source
# File actionmailer/test/log_subscriber_test.rb, line 22 def set_logger(logger) ActionMailer::Base.logger = logger end
setup()
click to toggle source
Calls superclass method
# File actionmailer/test/log_subscriber_test.rb, line 11 def setup super ActionMailer::LogSubscriber.attach_to :action_mailer end
test_deliver_is_notified()
click to toggle source
# File actionmailer/test/log_subscriber_test.rb, line 26 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
test_receive_is_notified()
click to toggle source
# File actionmailer/test/log_subscriber_test.rb, line 40 def test_receive_is_notified fixture = File.read(File.expand_path("fixtures/raw_email", __dir__)) 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