From eb9af20b7cc0e374277cf330bdd404f9daab28ec Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 22 Jan 2009 16:18:10 -0600 Subject: Begin unifying the interface between ActionController and ActionView --- actionmailer/test/mail_service_test.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index a886b1143e..d14f326163 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -566,13 +566,31 @@ class ActionMailerTest < Test::Unit::TestCase TestMailer.deliver_signed_up(@recipient) end + class FakeLogger + attr_reader :info_contents, :debug_contents + + def initialize + @info_contents, @debug_contents = "", "" + end + + def info(str) + @info_contents << str + end + + def debug(str) + @debug_contents << str + end + end + def test_delivery_logs_sent_mail mail = TestMailer.create_signed_up(@recipient) - logger = mock() - logger.expects(:info).with("Sent mail to #{@recipient}") - logger.expects(:debug).with("\n#{mail.encoded}") - TestMailer.logger = logger + # logger = mock() + # logger.expects(:info).with("Sent mail to #{@recipient}") + # logger.expects(:debug).with("\n#{mail.encoded}") + TestMailer.logger = FakeLogger.new TestMailer.deliver_signed_up(@recipient) + assert(TestMailer.logger.info_contents =~ /Sent mail to #{@recipient}/) + assert_equal(TestMailer.logger.debug_contents, "\n#{mail.encoded}") end def test_unquote_quoted_printable_subject -- cgit v1.2.3