}) It("responds with a relevant error message", func() { expectedBody, _ := json.Marshal(receptor.Error{ Type: receptor.InvalidRequest, Message: "process_guid missing from request", }) Expect(responseRecorder.Body.String()).To(Equal(string(expectedBody))) }) }) Context("when the BBS responds with an error", func() { BeforeEach(func(done Done) { defer close(done) fakeLegacyBBS.UpdateDesiredLRPReturns(errors.New("ka-boom")) handler.Update(responseRecorder, req) }) It("calls UpdateDesiredLRP on the BBS", func() { Expect(fakeLegacyBBS.UpdateDesiredLRPCallCount()).To(Equal(1)) _, processGuid, update := fakeLegacyBBS.UpdateDesiredLRPArgsForCall(0) Expect(processGuid).To(Equal(expectedProcessGuid)) Expect(update).To(Equal(expectedUpdate)) }) It("responds with 500 INTERNAL ERROR", func() { Expect(responseRecorder.Code).To(Equal(http.StatusInternalServerError)) }) It("responds with a relevant error message", func() {