package db_test import ( "github.com/cloudfoundry-incubator/notifications/db" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Connection", func() { var conn *db.Connection BeforeEach(func() { conn = &db.Connection{} }) Describe("Transaction", func() { It("returns an uninitialized transaction", func() { transaction := conn.Transaction() Expect(transaction).To(BeAssignableToTypeOf(&db.Transaction{})) }) }) })
package models_test import ( "github.com/cloudfoundry-incubator/notifications/db" "github.com/cloudfoundry-incubator/notifications/testing/helpers" "github.com/cloudfoundry-incubator/notifications/v1/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Receipts Repo", func() { var repo models.ReceiptsRepo var conn *db.Connection BeforeEach(func() { repo = models.NewReceiptsRepo() database := db.NewDatabase(sqlDB, db.Config{}) helpers.TruncateTables(database) conn = database.Connection().(*db.Connection) }) Describe("CreateReceipts", func() { var ( firstUserGUID string secondUserGUID string userGUIDs []string clientID string kindID string
"time" "github.com/cloudfoundry-incubator/notifications/db" "github.com/cloudfoundry-incubator/notifications/postal" "github.com/cloudfoundry-incubator/notifications/testing/helpers" "github.com/cloudfoundry-incubator/notifications/testing/mocks" "github.com/cloudfoundry-incubator/notifications/v2/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Messages Repository", func() { var ( repo models.MessagesRepository conn *db.Connection clock *mocks.Clock ) BeforeEach(func() { database := models.NewDatabase(sqlDB, models.Config{}) helpers.TruncateTables(db.NewDatabase(sqlDB, db.Config{})) conn = database.Connection().(*db.Connection) conn.AddTableWithName(models.Message{}, "messages") clock = mocks.NewClock() repo = models.NewMessagesRepository(clock) }) Describe("CountByStatus", func() { BeforeEach(func() {
package models_test import ( "github.com/cloudfoundry-incubator/notifications/application" "github.com/cloudfoundry-incubator/notifications/db" "github.com/cloudfoundry-incubator/notifications/testing/helpers" "github.com/cloudfoundry-incubator/notifications/v1/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("DatabaseMigrator", func() { var ( database *db.DB connection *db.Connection dbMigrator models.DatabaseMigrator defaultTemplatePath string ) BeforeEach(func() { env := application.NewEnvironment() defaultTemplatePath = env.RootPath + "/templates/default.json" database = db.NewDatabase(sqlDB, db.Config{ DefaultTemplatePath: defaultTemplatePath, }) helpers.TruncateTables(database) connection = database.Connection().(*db.Connection) dbMigrator = models.DatabaseMigrator{} }) Describe("migrating the database", func() {