err := response.Unmarshal(responseRecorder.Body.Bytes()) Expect(err).NotTo(HaveOccurred()) Expect(response.Error).To(BeNil()) }) It("emits a create event to the hub", func() { Eventually(desiredHub.EmitCallCount).Should(Equal(1)) event := desiredHub.EmitArgsForCall(0) createEvent, ok := event.(*models.DesiredLRPCreatedEvent) Expect(ok).To(BeTrue()) Expect(createEvent.DesiredLrp).To(Equal(desiredLRP)) }) It("creates and emits an event for one ActualLRP per index", func() { Expect(fakeActualLRPDB.CreateUnclaimedActualLRPCallCount()).To(Equal(5)) Eventually(actualHub.EmitCallCount).Should(Equal(5)) expectedLRPKeys := []*models.ActualLRPKey{} for i := 0; i < 5; i++ { expectedLRPKeys = append(expectedLRPKeys, &models.ActualLRPKey{ ProcessGuid: desiredLRP.ProcessGuid, Domain: desiredLRP.Domain, Index: int32(i), }) } for i := 0; i < 5; i++ { _, actualLRPKey := fakeActualLRPDB.CreateUnclaimedActualLRPArgsForCall(i)