import (
	"errors"

	"github.com/cloudfoundry-incubator/notifications/testing/mocks"
	"github.com/cloudfoundry-incubator/notifications/v1/models"
	"github.com/cloudfoundry-incubator/notifications/v1/services"

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

var _ = Describe("TemplateAssigner", func() {
	var (
		assigner      services.TemplateAssigner
		kindsRepo     *mocks.KindsRepo
		clientsRepo   *mocks.ClientsRepository
		templatesRepo *mocks.TemplatesRepo
		conn          *mocks.Connection
		database      *mocks.Database
	)

	BeforeEach(func() {
		conn = mocks.NewConnection()
		database = mocks.NewDatabase()
		database.ConnectionCall.Returns.Connection = conn

		clientsRepo = mocks.NewClientsRepository()
		kindsRepo = mocks.NewKindsRepo()
		templatesRepo = mocks.NewTemplatesRepo()

		assigner = services.NewTemplateAssigner(clientsRepo, kindsRepo, templatesRepo)
	})
import (
	"errors"

	"github.com/cloudfoundry-incubator/notifications/testing/mocks"
	"github.com/cloudfoundry-incubator/notifications/v1/models"
	"github.com/cloudfoundry-incubator/notifications/v1/services"

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

var _ = Describe("Deleter", func() {
	var (
		deleter       services.TemplateDeleter
		templatesRepo *mocks.TemplatesRepo
		database      *mocks.Database
		conn          *mocks.Connection
	)

	BeforeEach(func() {
		conn = mocks.NewConnection()
		database = mocks.NewDatabase()
		database.ConnectionCall.Returns.Connection = conn

		templatesRepo = mocks.NewTemplatesRepo()
		_, err := templatesRepo.Create(conn, models.Template{
			ID: "templateID",
		})
		Expect(err).NotTo(HaveOccurred())

		deleter = services.NewTemplateDeleter(templatesRepo)