Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vistahigherlearning / logstash   deb

Repository URL to install this package:

/ opt / logstash / vendor / bundle / jruby / 1.9 / gems / mail-2.5.3 / lib / mail / network / delivery_methods / test_mailer.rb

require 'mail/check_delivery_params'

module Mail
  # The TestMailer is a bare bones mailer that does nothing.  It is useful
  # when you are testing.
  # 
  # It also provides a template of the minimum methods you require to implement
  # if you want to make a custom mailer for Mail
  class TestMailer
    include Mail::CheckDeliveryParams

    # Provides a store of all the emails sent with the TestMailer so you can check them.
    def TestMailer.deliveries
      @@deliveries ||= []
    end

    # Allows you to over write the default deliveries store from an array to some
    # other object.  If you just want to clear the store, 
    # call TestMailer.deliveries.clear.
    # 
    # If you place another object here, please make sure it responds to:
    # 
    # * << (message)
    # * clear
    # * length
    # * size
    # * and other common Array methods
    def TestMailer.deliveries=(val)
      @@deliveries = val
    end

    def initialize(values)
      @settings = {}
    end
    
    attr_accessor :settings

    def deliver!(mail)
      check_params(mail)
      Mail::TestMailer.deliveries << mail
    end
    
  end
end