Esempio n. 1
0
		collection        collections.CampaignsCollection
		campaignsRepo     *mocks.CampaignsRepository
		campaignTypesRepo *mocks.CampaignTypesRepository
		templatesRepo     *mocks.TemplatesRepository
		sendersRepo       *mocks.SendersRepository
		userFinder        *mocks.UserFinder
		spaceFinder       *mocks.SpaceFinder
		orgFinder         *mocks.OrgFinder
	)

	BeforeEach(func() {
		conn = mocks.NewConnection()
		enqueuer = mocks.NewCampaignEnqueuer()
		campaignsRepo = mocks.NewCampaignsRepository()
		campaignTypesRepo = mocks.NewCampaignTypesRepository()
		templatesRepo = mocks.NewTemplatesRepository()
		sendersRepo = mocks.NewSendersRepository()
		userFinder = mocks.NewUserFinder()
		spaceFinder = mocks.NewSpaceFinder()
		orgFinder = mocks.NewOrgFinder()

		var err error
		startTime, err = time.Parse(time.RFC3339, "2015-09-01T12:34:56-07:00")
		Expect(err).NotTo(HaveOccurred())

		collection = collections.NewCampaignsCollection(enqueuer, campaignsRepo, campaignTypesRepo, templatesRepo, sendersRepo, userFinder, spaceFinder, orgFinder)
	})

	Describe("Create", func() {
		BeforeEach(func() {
			sendersRepo.GetCall.Returns.Sender = models.Sender{
	. "github.com/onsi/gomega"
)

var _ = Describe("CampaignTypesCollection", func() {
	var (
		campaignTypesCollection     collections.CampaignTypesCollection
		fakeCampaignTypesRepository *mocks.CampaignTypesRepository
		fakeSendersRepository       *mocks.SendersRepository
		fakeTemplatesRepository     *mocks.TemplatesRepository
		fakeDatabaseConnection      *mocks.Connection
	)

	BeforeEach(func() {
		fakeCampaignTypesRepository = mocks.NewCampaignTypesRepository()
		fakeSendersRepository = mocks.NewSendersRepository()
		fakeTemplatesRepository = mocks.NewTemplatesRepository()

		campaignTypesCollection = collections.NewCampaignTypesCollection(fakeCampaignTypesRepository, fakeSendersRepository, fakeTemplatesRepository)
		fakeDatabaseConnection = mocks.NewConnection()
	})

	Describe("Delete", func() {
		BeforeEach(func() {
			fakeCampaignTypesRepository.GetCall.Returns.CampaignType = models.CampaignType{
				ID:          "some-campaign-id",
				Name:        "My cool campaign type",
				Description: "description",
				Critical:    false,
				TemplateID:  "",
				SenderID:    "mysender",
			}