From f0523f72b46db14e2f50c8347a8708734c650f84 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Mon, 15 Feb 2010 21:44:30 +0700 Subject: Rename Rails::Subscriber to Rails::LogSubscriber --- actionmailer/test/log_subscriber_test.rb | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 actionmailer/test/log_subscriber_test.rb (limited to 'actionmailer/test/log_subscriber_test.rb') diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb new file mode 100644 index 0000000000..edd7c84d29 --- /dev/null +++ b/actionmailer/test/log_subscriber_test.rb @@ -0,0 +1,44 @@ +require "abstract_unit" +require "rails/log_subscriber/test_helper" +require "action_mailer/railties/log_subscriber" + +class AMLogSubscriberTest < ActionMailer::TestCase + include Rails::LogSubscriber::TestHelper + Rails::LogSubscriber.add(:action_mailer, ActionMailer::Railties::LogSubscriber.new) + + class TestMailer < ActionMailer::Base + def basic + recipients "somewhere@example.com" + subject "basic" + from "basic@example.com" + body "Hello world" + end + + def receive(mail) + # Do nothing + end + end + + def set_logger(logger) + ActionMailer::Base.logger = logger + end + + def test_deliver_is_notified + TestMailer.basic.deliver + wait + assert_equal(1, @logger.logged(:info).size) + assert_match(/Sent mail to somewhere@example.com/, @logger.logged(:info).first) + assert_equal(1, @logger.logged(:debug).size) + assert_match(/Hello world/, @logger.logged(:debug).first) + 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 \ No newline at end of file -- cgit v1.2.3 From 24ab5665b2f12a589e96a4b742cc49c08bf0e9df Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Tue, 23 Feb 2010 17:31:17 -0800 Subject: Revert "Fix test load paths for those not using bundler" This reverts commit eec2d301d4ce9df9c71c1a5aa63053eb970b6818. This commit broke tests. You cannot have a file called "bundler" on the load path. --- actionmailer/test/log_subscriber_test.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionmailer/test/log_subscriber_test.rb') diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb index 57b4a6a7f0..edd7c84d29 100644 --- a/actionmailer/test/log_subscriber_test.rb +++ b/actionmailer/test/log_subscriber_test.rb @@ -1,6 +1,3 @@ -railties_path = File.expand_path('../../../railties/lib', __FILE__) -$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path) - require "abstract_unit" require "rails/log_subscriber/test_helper" require "action_mailer/railties/log_subscriber" -- cgit v1.2.3 From 05f27761a23f3e939f35e4fb2d3c40f150dee49b Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Tue, 2 Mar 2010 22:55:09 -0800 Subject: Fix action_mailer tests --- actionmailer/test/log_subscriber_test.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionmailer/test/log_subscriber_test.rb') diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb index edd7c84d29..c08c34b4a2 100644 --- a/actionmailer/test/log_subscriber_test.rb +++ b/actionmailer/test/log_subscriber_test.rb @@ -4,7 +4,11 @@ require "action_mailer/railties/log_subscriber" class AMLogSubscriberTest < ActionMailer::TestCase include Rails::LogSubscriber::TestHelper - Rails::LogSubscriber.add(:action_mailer, ActionMailer::Railties::LogSubscriber.new) + + def setup + super + Rails::LogSubscriber.add(:action_mailer, ActionMailer::Railties::LogSubscriber.new) + end class TestMailer < ActionMailer::Base def basic -- cgit v1.2.3