Sha256: 25e24b7969688ff137f9f3023bec2955ba3d6bf6ef1e21cef6662602254d9f72

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

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

    @@deliveries = []

    def self.clear
      @@deliveries = []
    end

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

    def self.has_delivered?(email_name, conditions)
      @@deliveries.any? do |delivery|
        result = delivery.email_name == email_name
        if conditions[:to]
          result = result && delivery.to == conditions[:to]
        end
        result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailstro-0.1.0 lib/mailstro/test_strategy.rb
mailstro-0.0.10 lib/mailstro/test_strategy.rb