File: preview_test.go

package info (click to toggle)
golang-github-onsi-ginkgo-v2 2.15.0-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 4,112 kB
  • sloc: javascript: 59; sh: 14; makefile: 7
file content (51 lines) | stat: -rw-r--r-- 1,614 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package integration_test

import (
	"os"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

var _ = Describe("Preview", func() {
	BeforeEach(func() {
		fm.MountFixture("preview")
	})

	It("previews the specs, honoring the passed in flags", func() {
		os.Setenv("PREVIEW", "true")
		DeferCleanup(os.Unsetenv, "PREVIEW")
		session := startGinkgo(fm.PathTo("preview"), "--label-filter=elephant")
		Eventually(session).Should(gexec.Exit(0))
		Ω(session).Should(gbytes.Say("passed specs A"))
		Ω(session).Should(gbytes.Say("passed specs B"))
		Ω(session).Should(gbytes.Say("skipped specs C"))
		Ω(session).Should(gbytes.Say("skipped specs D"))
	})

	It("succeeds if you attempt to both run and preview specs", func() {
		os.Setenv("PREVIEW", "true")
		DeferCleanup(os.Unsetenv, "PREVIEW")
		os.Setenv("RUN", "true")
		DeferCleanup(os.Unsetenv, "RUN")
		session := startGinkgo(fm.PathTo("preview"))
		Eventually(session).Should(gexec.Exit(0))
		Ω(session).Should(gbytes.Say(`passed specs A`))
		Ω(session).Should(gbytes.Say(`passed specs B`))
		Ω(session).Should(gbytes.Say(`passed specs C`))
		Ω(session).Should(gbytes.Say(`passed specs D`))
		Ω(session).Should(gbytes.Say(`Ran 4 of 4 Specs`))
	})

	It("works if you run in parallel", func() {
		os.Setenv("PREVIEW", "true")
		DeferCleanup(os.Unsetenv, "PREVIEW")
		os.Setenv("RUN", "true")
		DeferCleanup(os.Unsetenv, "RUN")
		session := startGinkgo(fm.PathTo("preview"), "-p")
		Eventually(session).Should(gexec.Exit(0))
		Ω(session).Should(gbytes.Say(`Ran 4 of 4 Specs`))
	})
})