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