shouldStart bool err error ) BeforeEach(func() { taskGuid = "task-guid" cellId = "cell-id" }) JustBeforeEach(func() { shouldStart, err = controller.StartTask(logger, taskGuid, cellId) }) It("calls StartTask", func() { Expect(fakeTaskDB.StartTaskCallCount()).To(Equal(1)) taskLogger, taskGuid, cellId := fakeTaskDB.StartTaskArgsForCall(0) Expect(taskLogger.SessionName()).To(ContainSubstring("start-task")) Expect(taskGuid).To(Equal(taskGuid)) Expect(cellId).To(Equal(cellId)) }) Context("when the task should start", func() { BeforeEach(func() { fakeTaskDB.StartTaskReturns(true, nil) }) It("responds with true", func() { Expect(err).NotTo(HaveOccurred()) Expect(shouldStart).To(BeTrue()) }) })