1
0

progress_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package integration_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. "github.com/onsi/gomega/gbytes"
  6. "github.com/onsi/gomega/gexec"
  7. )
  8. var _ = Describe("Emitting progress", func() {
  9. var pathToTest string
  10. var session *gexec.Session
  11. var args []string
  12. BeforeEach(func() {
  13. args = []string{"--noColor"}
  14. pathToTest = tmpPath("progress")
  15. copyIn("progress_fixture", pathToTest)
  16. })
  17. JustBeforeEach(func() {
  18. session = startGinkgo(pathToTest, args...)
  19. Eventually(session).Should(gexec.Exit(0))
  20. })
  21. Context("with the -progress flag, but no -v flag", func() {
  22. BeforeEach(func() {
  23. args = append(args, "-progress")
  24. })
  25. It("should not emit progress", func() {
  26. Ω(session).ShouldNot(gbytes.Say("[bB]efore"))
  27. })
  28. })
  29. Context("with the -v flag", func() {
  30. BeforeEach(func() {
  31. args = append(args, "-v")
  32. })
  33. It("should not emit progress", func() {
  34. Ω(session).ShouldNot(gbytes.Say(`\[BeforeEach\]`))
  35. Ω(session).Should(gbytes.Say(`>outer before<`))
  36. })
  37. })
  38. Context("with the -progress flag and the -v flag", func() {
  39. BeforeEach(func() {
  40. args = append(args, "-progress", "-v")
  41. })
  42. It("should emit progress (by writing to the GinkgoWriter)", func() {
  43. Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`))
  44. Ω(session).Should(gbytes.Say(`>outer before<`))
  45. Ω(session).Should(gbytes.Say(`\[BeforeEach\] Inner Context`))
  46. Ω(session).Should(gbytes.Say(`>inner before<`))
  47. Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`))
  48. Ω(session).Should(gbytes.Say(`>outer just before<`))
  49. Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] Inner Context`))
  50. Ω(session).Should(gbytes.Say(`>inner just before<`))
  51. Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`))
  52. Ω(session).Should(gbytes.Say(`>it<`))
  53. Ω(session).Should(gbytes.Say(`\[AfterEach\] Inner Context`))
  54. Ω(session).Should(gbytes.Say(`>inner after<`))
  55. Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`))
  56. Ω(session).Should(gbytes.Say(`>outer after<`))
  57. })
  58. })
  59. })