Expect(d).To(Equal(domain)) Expect(ttl).To(Equal(ttl)) }) It("responds with 204 Status NO CONTENT", func() { Expect(responseRecorder.Code).To(Equal(http.StatusNoContent)) }) It("responds with an empty body", func() { Expect(responseRecorder.Body.String()).To(Equal("")) }) }) Context("when the call to the BBS fails", func() { BeforeEach(func() { fakeBBS.UpsertDomainReturns(errors.New("ka-boom")) }) It("responds with 500 INTERNAL ERROR", func() { Expect(responseRecorder.Code).To(Equal(http.StatusInternalServerError)) }) It("responds with a relevant error message", func() { expectedBody, _ := json.Marshal(receptor.Error{ Type: receptor.UnknownError, Message: "ka-boom", }) Expect(responseRecorder.Body.String()).To(Equal(string(expectedBody))) }) })