Пример #1
0
		Context("when marking the task as resolving fails", func() {
			BeforeEach(func() {
				var err error
				request, err = http.NewRequest("", "http://example.com?:task_guid=the-task-guid", nil)
				Expect(err).NotTo(HaveOccurred())
				fakeBBS.ResolvingTaskReturns(errors.New("Failed to resolve task"))
			})

			It("responds with an error", func() {
				handler.Delete(responseRecorder, request)
				Expect(responseRecorder.Code).To(Equal(http.StatusInternalServerError))
			})

			It("does not try to resolve the task", func() {
				handler.Delete(responseRecorder, request)
				Expect(fakeBBS.ResolveTaskCallCount()).To(BeZero())
			})
		})

		Context("when task cannot be resolved", func() {
			BeforeEach(func() {
				var err error
				request, err = http.NewRequest("", "http://example.com?:task_guid=the-task-guid", nil)
				Expect(err).NotTo(HaveOccurred())
				fakeBBS.ResolveTaskReturns(errors.New("Failed to resolve task"))
			})

			It("responds with an error", func() {
				handler.Delete(responseRecorder, request)
				Expect(responseRecorder.Code).To(Equal(http.StatusInternalServerError))
			})