Exemplo n.º 1
0
package gobble_test

import (
	"time"

	"github.com/cloudfoundry-incubator/notifications/gobble"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Worker", func() {
	var (
		queue                 *gobble.Queue
		worker                gobble.Worker
		callbackWasCalledWith gobble.Job
		callback              func(*gobble.Job)
		database              *gobble.DB
	)

	BeforeEach(func() {
		TruncateTables()

		callback = func(job *gobble.Job) {
			callbackWasCalledWith = *job
		}
		database = gobble.NewDatabase(sqlDB)

		queue = gobble.NewQueue(database, gobble.Config{})
		worker = gobble.NewWorker(1, queue, callback)
	})
Exemplo n.º 2
0
package gobble_test

import (
	"time"

	"github.com/cloudfoundry-incubator/notifications/gobble"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Queue", func() {
	var (
		queue    *gobble.Queue
		database *gobble.DB
	)

	BeforeEach(func() {
		TruncateTables()
		database = gobble.NewDatabase(sqlDB)

		queue = gobble.NewQueue(database, gobble.Config{
			WaitMaxDuration: 50 * time.Millisecond,
		})
	})

	AfterEach(func() {
		queue.Close()
	})

	Describe("Enqueue", func() {