Beispiel #1
0
func (m *Mother) EmailStrategy() services.EmailStrategy {
	return services.NewEmailStrategy(m.Enqueuer(), m.V2Enqueuer())
}
var _ = Describe("EmailStrategy", func() {
	var emailStrategy services.EmailStrategy

	Describe("Dispatch", func() {
		var (
			v1Enqueuer      *mocks.Enqueuer
			v2Enqueuer      *mocks.V2Enqueuer
			conn            *mocks.Connection
			requestReceived time.Time
		)

		BeforeEach(func() {
			v1Enqueuer = mocks.NewEnqueuer()
			v2Enqueuer = mocks.NewV2Enqueuer()
			emailStrategy = services.NewEmailStrategy(v1Enqueuer, v2Enqueuer)
			conn = mocks.NewConnection()
			requestReceived, _ = time.Parse(time.RFC3339Nano, "2015-06-08T14:37:35.181067085-07:00")
		})

		Context("when the dispatch JobType is unspecified", func() {
			It("calls Enqueue on it's enqueuer with proper arguments", func() {
				emailStrategy.Dispatch(services.Dispatch{
					Connection: conn,
					Client: services.DispatchClient{
						ID:          "some-client-id",
						Description: "description of a client",
					},
					Kind: services.DispatchKind{
						ID:          "some-kind-id",
						Description: "description of a kind",