예제 #1
0
func (m *Mother) TemplatesRepo() v1models.TemplatesRepo {
	return v1models.NewTemplatesRepo()
}
			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}}"))
			Expect(template.Text).To(Equal("{{.Endorsement}}\n{{.Text}}"))
			Expect(template.Metadata).To(Equal("{}"))
		})