1package integration_test 2 3import ( 4 . "github.com/onsi/ginkgo" 5 . "github.com/onsi/gomega" 6 "github.com/onsi/gomega/gbytes" 7 "github.com/onsi/gomega/gexec" 8) 9 10var _ = Describe("Emitting progress", func() { 11 var pathToTest string 12 var session *gexec.Session 13 var args []string 14 15 BeforeEach(func() { 16 args = []string{"--noColor"} 17 pathToTest = tmpPath("progress") 18 copyIn(fixturePath("progress_fixture"), pathToTest, false) 19 }) 20 21 JustBeforeEach(func() { 22 session = startGinkgo(pathToTest, args...) 23 Eventually(session).Should(gexec.Exit(0)) 24 }) 25 26 Context("with the -progress flag, but no -v flag", func() { 27 BeforeEach(func() { 28 args = append(args, "-progress") 29 }) 30 31 It("should not emit progress", func() { 32 Ω(session).ShouldNot(gbytes.Say("[bB]efore")) 33 }) 34 }) 35 36 Context("with the -v flag", func() { 37 BeforeEach(func() { 38 args = append(args, "-v") 39 }) 40 41 It("should not emit progress", func() { 42 Ω(session).ShouldNot(gbytes.Say(`\[BeforeEach\]`)) 43 Ω(session).Should(gbytes.Say(`>outer before<`)) 44 }) 45 }) 46 47 Context("with the -progress flag and the -v flag", func() { 48 BeforeEach(func() { 49 args = append(args, "-progress", "-v") 50 }) 51 52 It("should emit progress (by writing to the GinkgoWriter)", func() { 53 // First spec 54 55 Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) 56 Ω(session).Should(gbytes.Say(`>outer before<`)) 57 58 Ω(session).Should(gbytes.Say(`\[BeforeEach\] Inner Context`)) 59 Ω(session).Should(gbytes.Say(`>inner before<`)) 60 61 Ω(session).Should(gbytes.Say(`\[BeforeEach\] when Inner When`)) 62 Ω(session).Should(gbytes.Say(`>inner before<`)) 63 64 Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) 65 Ω(session).Should(gbytes.Say(`>outer just before<`)) 66 67 Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] Inner Context`)) 68 Ω(session).Should(gbytes.Say(`>inner just before<`)) 69 70 Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`)) 71 Ω(session).Should(gbytes.Say(`>it<`)) 72 73 Ω(session).Should(gbytes.Say(`\[AfterEach\] Inner Context`)) 74 Ω(session).Should(gbytes.Say(`>inner after<`)) 75 76 Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) 77 Ω(session).Should(gbytes.Say(`>outer after<`)) 78 79 // Second spec 80 81 Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) 82 Ω(session).Should(gbytes.Say(`>outer before<`)) 83 84 Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) 85 Ω(session).Should(gbytes.Say(`>outer just before<`)) 86 87 Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`)) 88 Ω(session).Should(gbytes.Say(`>specify<`)) 89 90 Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) 91 Ω(session).Should(gbytes.Say(`>outer after<`)) 92 }) 93 }) 94}) 95