It("provides a random hostname when the random-route option is set in the manifest", func() { manifestApp.Set("random-route", true) callPush("my-new-app") Expect(routeRepo.FindByHostAndDomainHost).To(Equal("my-new-app-laughing-cow")) }) }) It("creates an app when pushing for the first time", func() { routeRepo.FindByHostAndDomainErr = true appRepo.ReadNotFound = true callPush("-t", "111", "my-new-app") Expect(*appRepo.CreatedAppParams().Name).To(Equal("my-new-app")) Expect(*appRepo.CreatedAppParams().SpaceGuid).To(Equal("my-space-guid")) Expect(routeRepo.FindByHostAndDomainHost).To(Equal("my-new-app")) Expect(routeRepo.CreatedHost).To(Equal("my-new-app")) Expect(routeRepo.CreatedDomainGuid).To(Equal("foo-domain-guid")) Expect(routeRepo.BoundAppGuid).To(Equal("my-new-app-guid")) Expect(routeRepo.BoundRouteGuid).To(Equal("my-new-app-route-guid")) Expect(appBitsRepo.UploadedAppGuid).To(Equal("my-new-app-guid")) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Creating app", "my-new-app", "my-org", "my-space"}, {"OK"}, {"Creating", "my-new-app.foo.cf-app.com"}, {"OK"},
Describe("when pushing a new app", func() { BeforeEach(func() { appRepo.ReadReturns.Error = errors.NewModelNotFoundError("App", "the-app") routeRepo.FindByHostAndDomainErr = true }) It("refreshes the auth token (so fresh)", func() { // so clean callPush("fresh-prince") Expect(authRepo.RefreshTokenCalled).To(BeTrue()) }) It("creates an app", func() { callPush("-t", "111", "my-new-app") Expect(*appRepo.CreatedAppParams().Name).To(Equal("my-new-app")) Expect(*appRepo.CreatedAppParams().SpaceGuid).To(Equal("my-space-guid")) Expect(routeRepo.FindByHostAndDomainHost).To(Equal("my-new-app")) Expect(routeRepo.CreatedHost).To(Equal("my-new-app")) Expect(routeRepo.CreatedDomainGuid).To(Equal("foo-domain-guid")) Expect(routeRepo.BoundAppGuid).To(Equal("my-new-app-guid")) Expect(routeRepo.BoundRouteGuid).To(Equal("my-new-app-route-guid")) Expect(appBitsRepo.UploadedAppGuid).To(Equal("my-new-app-guid")) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Creating app", "my-new-app", "my-org", "my-space"}, {"OK"}, {"Creating", "my-new-app.foo.cf-app.com"}, {"OK"},