func (p *Provisioning) Update(ctx *app.UpdateProvisioningContext) error { instance, err := p.state.Instance(ctx.InstanceId) if err != nil { return ctx.NotFound() } instance.ServiceID = ctx.ServiceId instance.PlanID = ctx.PlanId p.state.UpdateInstance(*instance) return ctx.OK(&app.CfbrokerDashboard{}) }
Context("when there's no capacity", func() { BeforeEach(func() { state.AddInstanceReturns(errors.New("Failed")) err := provisioningController.Create(provisioningContext) Expect(err).ToNot(HaveOccurred()) }) It("responds with 503", func() { Expect(goaContext.ResponseStatus()).To(Equal(503)) }) }) }) Describe("#Update", func() { var provisioningContext *app.UpdateProvisioningContext BeforeEach(func() { var err error provisioningContext, err = app.NewUpdateProvisioningContext(goaContext) Expect(err).ToNot(HaveOccurred()) provisioningContext.InstanceId = "some-instance-id" }) Context("when all goes ok", func() { BeforeEach(func() { instance := repository.Instance{ ID: "some-instance-id", ServiceID: "service-1", PlanID: "plan-1",