module EventMachine
  class Kannel
    def self.deliveries
      @deliveries ||= []
    end

    Client.class_eval do
      def deliver(block = nil)
        EM::Kannel.deliveries << @message
      end
    end
  end
end

require "ostruct"

module EventMachine
  class Kannel
    def self.deliveries
      @deliveries ||= []
    end

    Client.class_eval do
      def fake_response
        status = OpenStruct.new(status: 202)
        http   = OpenStruct.new(response_header: status)

        Response.new(http, Time.now)
      end

      def deliver(&block)
        EM::Kannel.deliveries << @message
        yield(fake_response) if block_given?
      end
    end
  end
end

Make test helper work more like a real Client
Make test helper work more like a real Client

Client#deliver receives a block that allows the caller
to know the status of the HTTP call after the callback
fires.

By default we return a successful response using an
OpenStruct.
