Context("when the broker responds with operation data", func() { BeforeEach(func() { fakeServiceBroker.OperationDataToReturn = "some-operation-data" }) It("returns the operation data to the cloud controller", func() { Expect(response.Body).To(MatchJSON(fixture("operation_data_response.json"))) }) }) }) }) Context("when the broker indicates that it needs async support", func() { BeforeEach(func() { fakeServiceBroker.UpdateError = brokerapi.ErrAsyncRequired }) It("returns HTTP 422", func() { Expect(response.StatusCode).To(Equal(422)) }) It("returns a descriptive message", func() { var body map[string]string err := json.Unmarshal([]byte(response.Body), &body) Expect(err).ToNot(HaveOccurred()) Expect(body["error"]).To(Equal("AsyncRequired")) Expect(body["description"]).To(Equal("This service plan requires client support for asynchronous service operations.")) }) })