Exemplo n.º 1
0
func (m *Mother) MessagesRepo() v1models.MessagesRepo {
	return v1models.NewMessagesRepo()
}
Exemplo n.º 2
0
	"github.com/cloudfoundry-incubator/notifications/db"
	"github.com/cloudfoundry-incubator/notifications/postal"
	"github.com/cloudfoundry-incubator/notifications/testing/helpers"
	"github.com/cloudfoundry-incubator/notifications/v1/models"

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

var _ = Describe("MessagesRepo", func() {
	var repo models.MessagesRepo
	var conn db.ConnectionInterface
	var message models.Message

	BeforeEach(func() {
		repo = models.NewMessagesRepo()
		database := db.NewDatabase(sqlDB, db.Config{})
		helpers.TruncateTables(database)
		conn = database.Connection()
		message = models.Message{
			ID:         "message-id-123",
			CampaignID: "some-campaign-id",
			Status:     postal.StatusDelivered,
		}

	})

	Describe("FindByID", func() {
		It("finds messages created in the database", func() {
			message, err := repo.Create(conn, message)
			Expect(err).NotTo(HaveOccurred())