Esempio n. 1
0
			})

			It("returns error when upserting the domain", func() {
				upsertError := errors.New("You're not that fresh, buddy.")
				fakeReceptorClient.UpsertDomainReturns(upsertError)

				err := taskRunner.CreateTask(createTaskParams)
				Expect(err).To(MatchError(upsertError))

				Expect(fakeReceptorClient.TasksCallCount()).To(Equal(1))
				Expect(fakeReceptorClient.UpsertDomainCallCount()).To(Equal(1))
				Expect(fakeReceptorClient.CreateTaskCallCount()).To(Equal(0))
			})

			It("returns error when creating the task fails", func() {
				fakeReceptorClient.CreateTaskReturns(errors.New("not making your task"))

				err := taskRunner.CreateTask(createTaskParams)
				Expect(err).To(MatchError("not making your task"))

				Expect(fakeReceptorClient.TasksCallCount()).To(Equal(1))
				Expect(fakeReceptorClient.UpsertDomainCallCount()).To(Equal(1))
				Expect(fakeReceptorClient.CreateTaskCallCount()).To(Equal(1))
			})
		})
	})

	Describe("SubmitTask", func() {
		It("Submits a task from JSON", func() {
			environmentVariables := []receptor.EnvironmentVariable{
				receptor.EnvironmentVariable{