test/action_mailer.rb in adzap-ar_mailer-1.4.4 vs test/action_mailer.rb in adzap-ar_mailer-2.0.0

- old
+ new

@@ -1,7 +1,7 @@ require 'net/smtp' -require 'smtp_tls' +require 'smtp_tls' unless Net::SMTP.instance_methods.include?("enable_starttls_auto") require 'time' class Net::SMTP @reset_called = 0 @@ -20,30 +20,38 @@ send :remove_method, :start end - def self.start(*args) - @start_block.call if @start_block - yield new(nil) - end - def self.on_send_message(&block) @send_message_block = block end def self.on_start(&block) - @start_block = block + if block_given? + @start_block = block + else + @start_block + end end + def self.clear_on_start + @start_block = nil + end + def self.reset deliveries.clear on_start on_send_message @reset_called = 0 end + def start(*args) + self.class.on_start.call if self.class.on_start + yield self + end + alias test_old_reset reset if instance_methods.include? 'reset' def reset self.class.reset_called += 1 end @@ -65,9 +73,13 @@ module ActionMailer; end class ActionMailer::Base @server_settings = {} + + class << self + attr_accessor :delivery_method + end def self.logger o = Object.new def o.info(arg) end return o