-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflipper_test.go
50 lines (44 loc) · 895 Bytes
/
flipper_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
47
48
49
50
package toggle_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/xchapter7x/toggle"
)
func randomA(a, b int) int {
return a * b
}
func randomB(a, b int) int {
return a + b
}
var _ = Describe("Tgl", func() {
Context("calling the full chain", func() {
var (
tgl *Tgl
control int
argA int
argB int
rval int
)
BeforeEach(func() {
tgl = NewTgl()
control = 0
argA = 5
argB = 2
rval = control
Ω(func() {
_, err := tgl.Flag("randomFeature").
On(randomA).
Off(randomB).
Args(argA, argB).
Returns(&rval).
Run()
Ω(err).Should(BeNil())
}).ShouldNot(Panic())
})
It("should return the proper value to the return variable pointer given", func() {
controlRes := randomB(argA, argB)
Ω(rval).ShouldNot(Equal(control))
Ω(rval).Should(Equal(controlRes))
})
})
})