@@ -3,41 +3,24 @@ package globals_test
33import (
44 "testing"
55
6- . "github.com/onsi/ginkgo"
76 "github.com/onsi/ginkgo/extensions/globals"
8- . "github.com/onsi/gomega "
7+ "github.com/onsi/ginkgo/internal/global "
98)
109
1110func TestGlobals (t * testing.T ) {
12- RegisterFailHandler (Fail )
11+ global .InitializeGlobals ()
12+ oldSuite := global .Suite
13+ if oldSuite == nil {
14+ t .Error ("global.Suite was nil" )
15+ }
1316
14- // define some vars to store how many times a test has been run
15- var (
16- testI = 0
17- testII = 0
18- )
19-
20- // Define a simple gingko test I
21- var _ = Describe ("ginkgo test I" , func () {
22- It ("build tests I" , func () {
23- testI ++
24- Ω (testI ).Should (Equal (1 ))
25- })
26- })
27-
28- RunSpecs (t , "Test Runner Suite I" )
29-
30- // reset the global state of ginkgo. test I should now be removed, and it
31- // won't run twice.
3217 globals .Reset ()
33-
34- // Define a simple gingko test II
35- var _ = Describe ("ginkgo test II" , func () {
36- It ("build tests II" , func () {
37- testII ++
38- Ω (testII ).Should (Equal (1 ))
39- })
40- })
41-
42- RunSpecs (t , "Test Runner Suite II" )
18+ newSuite := global .Suite
19+ if newSuite == nil {
20+ t .Error ("new global.Suite was nil" )
21+ }
22+
23+ if oldSuite == newSuite {
24+ t .Error ("got the same suite but expected it to be different!" )
25+ }
4326}
0 commit comments