_, err = tarReader.Next() Expect(err).To(HaveOccurred()) }) Describe(".cfignore", func() { Context("when a .cfignore file is present", func() { BeforeEach(func() { Expect(ioutil.WriteFile(filepath.Join(tmpDir, ".cfignore"), []byte("cfignore contents"), 0644)).To(Succeed()) }) It("parses a .cfignore file if present", func() { test_helpers.ExecuteCommandWithArgs(buildDropletCommand, []string{"droplet-name", "http://some.url/for/buildpack"}) Expect(fakeCFIgnore.ParseCallCount()).To(Equal(1)) Expect(ioutil.ReadAll(fakeCFIgnore.ParseArgsForCall(0))).To(Equal([]byte("cfignore contents"))) }) Context("when parsing the .cfignore file fails", func() { It("returns an error without uploading any bits", func() { fakeCFIgnore.ParseReturns(errors.New("some cfignore parse error")) test_helpers.ExecuteCommandWithArgs(buildDropletCommand, []string{"droplet-name", "http://some.url/for/buildpack"}) Expect(outputBuffer).To(test_helpers.Say("some cfignore parse error")) Expect(fakeDropletRunner.UploadBitsCallCount()).To(Equal(0)) Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{exit_codes.FileSystemError})) }) }) })