Sha256: 67647b2143f07e3aeeabd6e7cc1fb5ef7e6f2b959ade339d7498109176f0e357

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

module Mailstro
  module TestStrategy
    def self.enable
      Mailstro.strategy = Mailstro::TestStrategy
    end

    @@deliveries = []

    def self.clear
      @@deliveries = []
    end

    def self.deliver(options)
      @@deliveries << Delivery.new(options)
    end

    def self.has_delivered?(conditions)
      @@deliveries.any? do |delivery|
        result = true
        if conditions.is_a?(Hash)
          if conditions[:template_name]
            result = result && delivery.template_name == conditions[:template_name]
          end
          if conditions[:to]
            result = result && delivery.contact_email == conditions[:to]
          end
        else
          result = delivery.template_name == conditions
        end
        result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailstro-0.0.9 lib/mailstro/test_strategy.rb