Ejemplo n.º 1
0
		})

		JustBeforeEach(func() {
			handler.GetByProcessGuidAndIndex(responseRecorder, req)
		})

		Context("when getting the LRP group from the BBS succeeds", func() {
			BeforeEach(func() {
				fakeLegacyBBS.ActualLRPGroupByProcessGuidAndIndexReturns(
					oldmodels.ActualLRPGroup{Instance: &oldActualLRP2},
					nil,
				)
			})

			It("calls the BBS to retrieve the actual LRPs", func() {
				Expect(fakeLegacyBBS.ActualLRPGroupByProcessGuidAndIndexCallCount()).To(Equal(1))
				_, processGuid, index := fakeLegacyBBS.ActualLRPGroupByProcessGuidAndIndexArgsForCall(0)
				Expect(processGuid).To(Equal("process-guid-1"))
				Expect(index).To(Equal(2))
			})

			It("responds with 200 Status OK", func() {
				Expect(responseRecorder.Code).To(Equal(http.StatusOK))
			})

			It("returns an actual lrp response", func() {
				response := receptor.ActualLRPResponse{}
				err := json.Unmarshal(responseRecorder.Body.Bytes(), &response)
				Expect(err).NotTo(HaveOccurred())

				Expect(response).To(Equal(serialization.ActualLRPToResponse(oldActualLRP2, false)))