aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_service_test.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-01-22 16:18:10 -0600
committerJoshua Peek <josh@joshpeek.com>2009-01-22 16:18:10 -0600
commiteb9af20b7cc0e374277cf330bdd404f9daab28ec (patch)
treeba05a906690684e442ed92db3e63e295f0dd133e /actionmailer/test/mail_service_test.rb
parentcc0b5fa9930dcc60914e21b518b3c54109243cfa (diff)
downloadrails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.gz
rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.bz2
rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.zip
Begin unifying the interface between ActionController and ActionView
Diffstat (limited to 'actionmailer/test/mail_service_test.rb')
-rw-r--r--actionmailer/test/mail_service_test.rb26
1 files changed, 22 insertions, 4 deletions
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