func (repo *FakeManifestRepository) ReadManifest(inputPath string) (m *manifest.Manifest, err error) { repo.ReadManifestArgs.Path = inputPath if repo.ReadManifestReturns.Manifest != nil { m = repo.ReadManifestReturns.Manifest } else { m = manifest.NewEmptyManifest() } err = repo.ReadManifestReturns.Error return }
callPush("-p", "../some/path-to/an-app", "app-with-path") appDir, _ := actor.GatherFilesArgsForCall(0) Expect(appDir).To(Equal("../some/path-to/an-app")) }) It("pushes the contents of the current working directory by default", func() { callPush("app-with-default-path") dir, _ := os.Getwd() appDir, _ := actor.GatherFilesArgsForCall(0) Expect(appDir).To(Equal(dir)) }) It("fails when given a bad manifest path", func() { manifestRepo.ReadManifestReturns.Manifest = manifest.NewEmptyManifest() manifestRepo.ReadManifestReturns.Error = errors.New("read manifest error") callPush("-f", "bad/manifest/path") Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, []string{"read manifest error"}, )) }) It("does not fail when the current working directory does not contain a manifest", func() { manifestRepo.ReadManifestReturns.Manifest = singleAppManifest() manifestRepo.ReadManifestReturns.Error = syscall.ENOENT manifestRepo.ReadManifestReturns.Manifest.Path = ""