From 34b23e7110a3a13cf157608cefc9b5701017bf39 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 10 Sep 2012 12:52:19 -0700 Subject: Action Mailer async flag is true by default using a Synchronous impl --- actionmailer/test/abstract_unit.rb | 9 +++++++++ actionmailer/test/base_test.rb | 6 +++--- actionmailer/test/mailers/async_mailer.rb | 1 - 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 99c44179fd..e5f9bae897 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -11,6 +11,7 @@ end require 'minitest/autorun' require 'action_mailer' require 'action_mailer/test_case' +require 'rails/queueing' silence_warnings do # These external dependencies have warnings :/ @@ -27,6 +28,14 @@ ActionView::Template.register_template_handler :bak, lambda { |template| "Lame b FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__)) ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH +class ActionMailer::Base < AbstractController::Base + class << self + def queue + @queue ||= Rails::Queueing::Container.new(Rails::Queueing::SynchronousQueue.new) + end + end +end + class MockSMTP def self.deliveries @@deliveries diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index c7b8f47d89..862b954f9e 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -575,11 +575,11 @@ class BaseTest < ActiveSupport::TestCase end test "being able to put proc's into the defaults hash and they get evaluated on mail sending" do - mail1 = ProcMailer.welcome + mail1 = ProcMailer.welcome['X-Proc-Method'] yesterday = 1.day.ago Time.stubs(:now).returns(yesterday) - mail2 = ProcMailer.welcome - assert(mail1['X-Proc-Method'].to_s.to_i > mail2['X-Proc-Method'].to_s.to_i) + mail2 = ProcMailer.welcome['X-Proc-Method'] + assert(mail1.to_s.to_i > mail2.to_s.to_i) end test "we can call other defined methods on the class as needed" do diff --git a/actionmailer/test/mailers/async_mailer.rb b/actionmailer/test/mailers/async_mailer.rb index ce601e7343..8a87e2e1cf 100644 --- a/actionmailer/test/mailers/async_mailer.rb +++ b/actionmailer/test/mailers/async_mailer.rb @@ -1,3 +1,2 @@ class AsyncMailer < BaseMailer - self.async = true end -- cgit v1.2.3