diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-16 18:30:23 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-16 22:37:47 -0700 |
commit | 2a301505ece91b1bf317c6627aaba7ec0cea43e9 (patch) | |
tree | ca01f2d6bf360fe884721ee48a19f3b2a2aaed1c /actionmailer/test | |
parent | b881be7331339d7eab50ccf0512de3ab4e49a896 (diff) | |
download | rails-2a301505ece91b1bf317c6627aaba7ec0cea43e9.tar.gz rails-2a301505ece91b1bf317c6627aaba7ec0cea43e9.tar.bz2 rails-2a301505ece91b1bf317c6627aaba7ec0cea43e9.zip |
Use synchronous queue by default. Separate queued message delivery jobs from the queued message wrappers so the queue itself needn't be marshaled (due to queue reference QueuedMessage).
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/abstract_unit.rb | 1 | ||||
-rw-r--r-- | actionmailer/test/base_test.rb | 23 | ||||
-rw-r--r-- | actionmailer/test/mailers/async_mailer.rb | 1 |
3 files changed, 8 insertions, 17 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 0b418c4ea1..4b38d4bd31 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -27,7 +27,6 @@ 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 -ActionMailer::Base.queue = ActiveSupport::SynchronousQueue.new class MockSMTP def self.deliveries diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 6a06cec041..4f2af50fdd 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -412,7 +412,7 @@ class BaseTest < ActiveSupport::TestCase BaseMailer.deliveries.clear BaseMailer.expects(:deliver_mail).once mail = BaseMailer.welcome.deliver - assert_instance_of Mail::Message, mail + assert_equal 'The first email on new API!', mail.subject end test "calling deliver on the action should increment the deliveries collection if using the test mailer" do @@ -422,24 +422,15 @@ class BaseTest < ActiveSupport::TestCase assert_equal(1, BaseMailer.deliveries.length) end - def stub_queue(klass, queue) - Class.new(klass) { - extend Module.new { - define_method :queue do - queue - end - } - } - end - test "delivering message asynchronously" do - testing_queue = ActiveSupport::TestQueue.new AsyncMailer.delivery_method = :test AsyncMailer.deliveries.clear - stub_queue(AsyncMailer, testing_queue).welcome.deliver - assert_equal(0, AsyncMailer.deliveries.length) - testing_queue.drain - assert_equal(1, AsyncMailer.deliveries.length) + + AsyncMailer.welcome.deliver + assert_equal 0, AsyncMailer.deliveries.length + + AsyncMailer.queue.drain + assert_equal 1, AsyncMailer.deliveries.length end test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do diff --git a/actionmailer/test/mailers/async_mailer.rb b/actionmailer/test/mailers/async_mailer.rb index 8a87e2e1cf..c21a464f38 100644 --- a/actionmailer/test/mailers/async_mailer.rb +++ b/actionmailer/test/mailers/async_mailer.rb @@ -1,2 +1,3 @@ class AsyncMailer < BaseMailer + self.queue = ActiveSupport::TestQueue.new end |