BeforeEach(func() { store.BumpDesiredFreshness(time.Unix(0, 0)) store.BumpActualFreshness(time.Unix(0, 0)) }) Context("when the app query parameters do not correspond to an existing app", func() { It("should respond with an empty hash", func() { response := makeRequest(`{"droplet":"elephant","version":"pink-flamingo"}`) Ω(response).Should(Equal("{}")) }) }) Context("when the app query parameters correspond to an existing app", func() { It("should return the actual instances and crashes of the app", func() { response := makeRequest(validRequestPayload) Ω(response).Should(Equal(string(expectedApp.ToJSON()))) }) }) Context("when something else goes wrong with the store", func() { BeforeEach(func() { storeAdapter.GetErrInjector = fakestoreadapter.NewFakeStoreAdapterErrorInjector("desired", fmt.Errorf("No desired state for you!")) }) It("should return an empty hash", func() { response := makeRequest(validRequestPayload) Ω(response).Should(Equal("{}")) }) }) })