panic(err) } rows.Close() Expect(tables).To(ContainElement("clients")) Expect(tables).To(ContainElement("kinds")) Expect(tables).To(ContainElement("receipts")) Expect(tables).To(ContainElement("unsubscribes")) Expect(tables).To(ContainElement("global_unsubscribes")) Expect(tables).To(ContainElement("templates")) }) }) Describe("seeding the default template", func() { var repo models.TemplatesRepo BeforeEach(func() { repo = models.NewTemplatesRepo() }) It("has the default template pre-seeded", func() { _, err := repo.FindByID(connection, models.DefaultTemplateID) Expect(err).To(BeAssignableToTypeOf(models.RecordNotFoundError(""))) dbMigrator.Seed(database, defaultTemplatePath) template, err := repo.FindByID(connection, models.DefaultTemplateID) Expect(err).NotTo(HaveOccurred()) Expect(template.Name).To(Equal("Default Template")) Expect(template.Subject).To(Equal("CF Notification: {{.Subject}}")) Expect(template.HTML).To(Equal("<p>{{.Endorsement}}</p>{{.HTML}}"))
package models_test import ( "time" "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("TemplatesRepo", func() { var repo models.TemplatesRepo var conn db.ConnectionInterface var template models.Template var createdAt time.Time BeforeEach(func() { repo = models.NewTemplatesRepo() database := db.NewDatabase(sqlDB, db.Config{}) helpers.TruncateTables(database) conn = database.Connection() createdAt = time.Now().Add(-1 * time.Hour).Truncate(1 * time.Second).UTC() template = models.Template{ ID: "raptor_template", Name: "Raptors On The Run", Text: "run and hide", HTML: "<h1>containment unit breached!</h1>",