Error: errors.New("fake-error"), } runner.AddCmdResult("bash -x packaging", fakeResult) }) It("returns error", func() { _, _, err := compiler.Compile(pkg) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("Compiling package")) Expect(err.Error()).To(ContainSubstring("fake-error")) }) }) Context("when compression fails", func() { JustBeforeEach(func() { compressor.CompressFilesInDirErr = errors.New("fake-compression-error") }) It("returns error", func() { _, _, err := compiler.Compile(pkg) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("Compressing compiled package")) }) }) Context("when adding to blobstore fails", func() { JustBeforeEach(func() { blobstore.CreateErr = errors.New("fake-error") }) It("returns error", func() {