Expect(desired).To(Equal(expectedDesiredLRP)) }) It("responds with 201 CREATED", func() { Expect(responseRecorder.Code).To(Equal(http.StatusCreated)) }) It("responds with an empty body", func() { Expect(responseRecorder.Body.String()).To(Equal("")) }) }) Context("when the BBS responds with an error", func() { BeforeEach(func(done Done) { defer close(done) fakeLegacyBBS.DesireLRPReturns(errors.New("ka-boom")) handler.Create(responseRecorder, newTestRequest(validCreateLRPRequest)) }) It("calls DesireLRP on the BBS", func() { Expect(fakeLegacyBBS.DesireLRPCallCount()).To(Equal(1)) _, desired := fakeLegacyBBS.DesireLRPArgsForCall(0) Expect(desired).To(Equal(expectedDesiredLRP)) }) 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{