示例#1
0
			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())
				})
			})

			Context("when the task should not start", func() {
				BeforeEach(func() {
					fakeTaskDB.StartTaskReturns(false, nil)
				})

				It("responds with false", func() {
					Expect(err).NotTo(HaveOccurred())