...
1 package integration_test
2
3 import (
4 "os"
5
6 . "github.com/onsi/ginkgo/v2"
7 . "github.com/onsi/gomega"
8 "github.com/onsi/gomega/gbytes"
9 "github.com/onsi/gomega/gexec"
10 )
11
12 var _ = Describe("Preview", func() {
13 BeforeEach(func() {
14 fm.MountFixture("preview")
15 })
16
17 It("previews the specs, honoring the passed in flags", func() {
18 os.Setenv("PREVIEW", "true")
19 DeferCleanup(os.Unsetenv, "PREVIEW")
20 session := startGinkgo(fm.PathTo("preview"), "--label-filter=elephant")
21 Eventually(session).Should(gexec.Exit(0))
22 Ω(session).Should(gbytes.Say("passed specs A"))
23 Ω(session).Should(gbytes.Say("passed specs B"))
24 Ω(session).Should(gbytes.Say("skipped specs C"))
25 Ω(session).Should(gbytes.Say("skipped specs D"))
26 })
27
28 It("succeeds if you attempt to both run and preview specs", func() {
29 os.Setenv("PREVIEW", "true")
30 DeferCleanup(os.Unsetenv, "PREVIEW")
31 os.Setenv("RUN", "true")
32 DeferCleanup(os.Unsetenv, "RUN")
33 session := startGinkgo(fm.PathTo("preview"))
34 Eventually(session).Should(gexec.Exit(0))
35 Ω(session).Should(gbytes.Say(`passed specs A`))
36 Ω(session).Should(gbytes.Say(`passed specs B`))
37 Ω(session).Should(gbytes.Say(`passed specs C`))
38 Ω(session).Should(gbytes.Say(`passed specs D`))
39 Ω(session).Should(gbytes.Say(`Ran 4 of 4 Specs`))
40 })
41
42 It("works if you run in parallel", func() {
43 os.Setenv("PREVIEW", "true")
44 DeferCleanup(os.Unsetenv, "PREVIEW")
45 os.Setenv("RUN", "true")
46 DeferCleanup(os.Unsetenv, "RUN")
47 session := startGinkgo(fm.PathTo("preview"), "-p")
48 Eventually(session).Should(gexec.Exit(0))
49 Ω(session).Should(gbytes.Say(`Ran 4 of 4 Specs`))
50 })
51 })
52
View as plain text