})

		Context("when it has been overridden", func() {
			It("does not re-seed the default template", func() {
				dbMigrator.Seed(database, defaultTemplatePath)

				template, err := repo.FindByID(connection, models.DefaultTemplateID)
				Expect(err).NotTo(HaveOccurred())

				template.Name = "Updated Default"
				template.Subject = "Updated Subject"
				template.Text = "Updated Text"
				template.HTML = "Updated HTML"
				template.Metadata = `{"test": true}`
				template.Overridden = true
				_, err = repo.Update(connection, models.DefaultTemplateID, template)
				Expect(err).NotTo(HaveOccurred())

				dbMigrator.Seed(database, defaultTemplatePath)

				template, err = repo.FindByID(connection, models.DefaultTemplateID)
				Expect(err).NotTo(HaveOccurred())
				Expect(template.Name).To(Equal("Updated Default"))
				Expect(template.Subject).To(Equal("Updated Subject"))
				Expect(template.HTML).To(Equal("Updated HTML"))
				Expect(template.Text).To(Equal("Updated Text"))
				Expect(template.Metadata).To(Equal(`{"test": true}`))
				Expect(template.Overridden).To(BeTrue())
			})
		})
	})
	Describe("Update", func() {
		var aNewTemplate models.Template

		BeforeEach(func() {
			aNewTemplate = models.Template{
				Name:     "a brand new name",
				Subject:  "Some new subject",
				Text:     "some newer text",
				HTML:     "<p>new HTML</p>",
				Metadata: "{\"cloudy\": true}",
			}
		})

		Context("the template exists in the database", func() {
			It("updates a template currently in the database", func() {
				_, err := repo.Update(conn, template.ID, aNewTemplate)
				Expect(err).ToNot(HaveOccurred())

				foundTemplate, err := repo.FindByID(conn, template.ID)
				if err != nil {
					panic(err)
				}

				Expect(foundTemplate.Name).To(Equal(aNewTemplate.Name))
				Expect(foundTemplate.Subject).To(Equal(aNewTemplate.Subject))
				Expect(foundTemplate.Text).To(Equal(aNewTemplate.Text))
				Expect(foundTemplate.HTML).To(Equal(aNewTemplate.HTML))
				Expect(foundTemplate.Metadata).To(Equal(aNewTemplate.Metadata))
				Expect(foundTemplate.CreatedAt).To(Equal(createdAt))
				Expect(foundTemplate.UpdatedAt).ToNot(Equal(createdAt))
				Expect(foundTemplate.UpdatedAt).To(BeTemporally(">", createdAt))