Exemplo n.º 1
0
		Context("when the input is a zipfile", func() {
			var expectedFileMode string

			BeforeEach(func() {
				zipper.IsZipFileReturns(true)

				zipper.UnzipStub = func(source string, dest string) error {
					err := os.Mkdir(filepath.Join(dest, "example-app"), os.ModeDir|os.ModePerm)
					Expect(err).NotTo(HaveOccurred())

					f, err := os.Create(filepath.Join(dest, "example-app/ignore-me"))
					Expect(err).NotTo(HaveOccurred())
					defer f.Close()

					err = ioutil.WriteFile(filepath.Join(dest, "example-app/ignore-me"), []byte("This is a test file"), os.ModePerm)

					info, err := os.Lstat(filepath.Join(dest, "example-app/ignore-me"))
					Expect(err).NotTo(HaveOccurred())

					expectedFileMode = fmt.Sprintf("%#o", info.Mode())

					return nil
				}

			})

			It("extracts the zip", func() {
				fileutils.TempDir("gather-files", func(tmpDir string, err error) {
					Expect(err).NotTo(HaveOccurred())