blocky/cmd/cmd_suite_test.go

32 lines
509 B
Go
Raw Normal View History

2020-05-04 22:20:13 +02:00
package cmd
import (
"testing"
2021-08-25 22:06:34 +02:00
. "github.com/0xERR0R/blocky/log"
2020-05-04 22:20:13 +02:00
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus/hooks/test"
)
var (
fatal bool
loggerHook *test.Hook
)
func TestCmd(t *testing.T) {
BeforeSuite(func() {
Log().ExitFunc = func(int) { fatal = true }
2020-05-04 22:20:13 +02:00
loggerHook = test.NewGlobal()
Log().AddHook(loggerHook)
2020-05-04 22:20:13 +02:00
})
AfterSuite(func() {
Log().ExitFunc = nil
2020-05-04 22:20:13 +02:00
loggerHook.Reset()
})
RegisterFailHandler(Fail)
RunSpecs(t, "Command Suite")
}