예제 #1
0
			var (
				taskGuid string
				err      error
			)

			BeforeEach(func() {
				taskGuid = "task-guid"
			})

			JustBeforeEach(func() {
				err = controller.DeleteTask(logger, taskGuid)
			})

			Context("when deleting the task succeeds", func() {
				It("returns no error", func() {
					Expect(fakeTaskDB.DeleteTaskCallCount()).To(Equal(1))
					_, taskGuid := fakeTaskDB.DeleteTaskArgsForCall(0)
					Expect(taskGuid).To(Equal("task-guid"))
					Expect(err).NotTo(HaveOccurred())
				})
			})

			Context("when desiring the task fails", func() {
				BeforeEach(func() {
					fakeTaskDB.DeleteTaskReturns(errors.New("kaboom"))
				})

				It("responds with an error", func() {
					Expect(err).To(MatchError("kaboom"))
				})
			})