-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage_test.go
46 lines (35 loc) · 1021 Bytes
/
storage_test.go
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
package cogol
import (
"testing"
)
func TestStorage(t *testing.T) {
cgl := Init(t)
g := cgl.Group("Storage")
{
propname := "test1property"
bepropname := "bepropname"
// Overriding before each
g.BeforeEach(func(c *Context) {
c.Storage().Set(bepropname, 727)
})
g.T("'propname' should not be accessible from other tests", func(c *Context) {
c.Storage().Set(propname, 42)
})
g.T("'propname' should not be accessible from here", func(c *Context) {
c.Expect(c.Storage().Get(propname)).ToBeNil()
})
g.T("should be accessible because of beforeeach", func(c *Context) {
c.Expect(c.Storage().Get(bepropname)).ToBe(727)
c.Log().Info("should be accessible because of beforeeach")
})
g.T("here as well", func(c *Context) {
c.Expect(c.Storage().Get(bepropname)).ToBe(727)
c.Log().Info("here as well")
})
g.T("propname should be overridden", func(c *Context) {
c.Storage().Set(propname, 4444)
c.Expect(c.Storage().Get(propname)).ToBe(4444)
})
}
cgl.Process()
}